DatagramSocketIO (Jython API documentation)
Date: 2022-09-10

org.python.core.io

## Class DatagramSocketIO

- java.lang.Object
- - org.python.core.io.IOBase
  - - org.python.core.io.RawIOBase
    - - org.python.core.io.SocketIOBase<java.nio.channels.DatagramChannel>
      - - org.python.core.io.DatagramSocketIO

-     public class DatagramSocketIO
      extends SocketIOBase<java.nio.channels.DatagramChannel>

  Raw I/O implementation for datagram sockets.
  Author:
    Philip Jenvey

- - ### Field Summary

    - ### Fields inherited from class org.python.core.io.IOBase

      `DEFAULT_BUFFER_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatagramSocketIO(java.nio.channels.DatagramChannel socketChannel, java.lang.String mode)` Construct a DatagramSocketIO for the given DatagramChannel.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `readinto(java.nio.ByteBuffer buf)` Read up to buf.remaining() bytes into buf.
    `long` | `readinto(java.nio.ByteBuffer[] bufs)` Read bytes into each of the specified ByteBuffers via scatter i/o.
    `int` | `write(java.nio.ByteBuffer buf)` Write the given ByteBuffer to the IO stream.
    `long` | `write(java.nio.ByteBuffer[] bufs)` Writes bytes from each of the specified ByteBuffers via gather i/o.

    - ### Methods inherited from class org.python.core.io.SocketIOBase

      `close, getChannel, readable, writable`

    - ### Methods inherited from class org.python.core.io.RawIOBase

      `fileno, read, readall`

    - ### Methods inherited from class org.python.core.io.IOBase

      `asInputStream, asOutputStream, checkClosed, checkReadable, checkWritable, closed, flush, isatty, seek, seek, tell, truncate`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DatagramSocketIO

          public DatagramSocketIO(java.nio.channels.DatagramChannel socketChannel,
                                  java.lang.String mode)

      Construct a DatagramSocketIO for the given DatagramChannel.
      Parameters:
        `socketChannel` - a DatagramChannel to wrap
        `mode` - a raw io socket mode String

  - ### Method Detail

    - #### readinto

          public int readinto(java.nio.ByteBuffer buf)

      Description copied from class: `RawIOBase`
      Read up to buf.remaining() bytes into buf. Returns number of bytes read (0 for EOF).
      Overrides:
        `readinto` in class `RawIOBase`
      Parameters:
        `buf` - a ByteBuffer to read bytes into
      Returns:
        the amount of data read as an int

    - #### readinto

          public long readinto(java.nio.ByteBuffer[] bufs)

      Read bytes into each of the specified ByteBuffers via scatter i/o.
      Overrides:
        `readinto` in class `RawIOBase`
      Parameters:
        `bufs` - an array of ByteBuffers to read bytes into
      Returns:
        the amount of data read as a long

    - #### write

          public int write(java.nio.ByteBuffer buf)

      Description copied from class: `RawIOBase`
      Write the given ByteBuffer to the IO stream. Returns the number of bytes written, which may be less than buf.remaining().
      Overrides:
        `write` in class `RawIOBase`
      Parameters:
        `buf` - a ByteBuffer value
      Returns:
        the number of bytes written as an int

    - #### write

          public long write(java.nio.ByteBuffer[] bufs)

      Writes bytes from each of the specified ByteBuffers via gather i/o.
      Overrides:
        `write` in class `RawIOBase`
      Parameters:
        `bufs` - an array of ByteBuffers
      Returns:
        the number of bytes written as a long

Jython homepage