DatagramChannel.Read Method

Definition

Overloads

Read(ByteBuffer[])

Reads a datagram from this channel.

Read(ByteBuffer[], Int32, Int32)

Reads a datagram from this channel.

Read(ByteBuffer)

Reads a datagram from this channel.

Read(ByteBuffer[])

Reads a datagram from this channel.

[Android.Runtime.Register("read", "([Ljava/nio/ByteBuffer;)J", "")]
public long Read (Java.Nio.ByteBuffer[]? dsts);
[<Android.Runtime.Register("read", "([Ljava/nio/ByteBuffer;)J", "")>]
abstract member Read : Java.Nio.ByteBuffer[] -> int64
override this.Read : Java.Nio.ByteBuffer[] -> int64

Parameters

dsts
ByteBuffer[]

Returns

Implements

Attributes

Exceptions

if the channel is not connected yet.

if the channel is already closed.

if the channel is closed by another thread while this method is in operation.

if another thread interrupts the calling thread while the operation is in progress. The calling thread will have the interrupt state set and the channel will be closed.

some other I/O error occurs.

Remarks

Reads a datagram from this channel.

This method may only be invoked if this channel's socket is connected, and it only accepts datagrams from the socket's peer. If there are more bytes in the datagram than remain in the given buffers then the remainder of the datagram is silently discarded. Otherwise this method behaves exactly as specified in the ScatteringByteChannel interface.

Java documentation for java.nio.channels.DatagramChannel.read(java.nio.ByteBuffer[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Read(ByteBuffer[], Int32, Int32)

Reads a datagram from this channel.

[Android.Runtime.Register("read", "([Ljava/nio/ByteBuffer;II)J", "GetRead_arrayLjava_nio_ByteBuffer_IIHandler")]
public abstract long Read (Java.Nio.ByteBuffer[]? dsts, int offset, int length);
[<Android.Runtime.Register("read", "([Ljava/nio/ByteBuffer;II)J", "GetRead_arrayLjava_nio_ByteBuffer_IIHandler")>]
abstract member Read : Java.Nio.ByteBuffer[] * int * int -> int64

Parameters

dsts
ByteBuffer[]
offset
Int32

a non-negative offset in the array of buffers, pointing to the starting buffer to store the bytes transferred, must not be bigger than targets.length.

length
Int32

a non-negative length to indicate the maximum number of buffers to be filled, must not be bigger than targets.length - offset.

Returns

Implements

Attributes

Exceptions

if the channel is not connected yet.

if the channel is already closed.

if the channel is closed by another thread while this method is in operation.

if another thread interrupts the calling thread while the operation is in progress. The calling thread will have the interrupt state set and the channel will be closed.

some other I/O error occurs.

Remarks

Reads a datagram from this channel.

This method may only be invoked if this channel's socket is connected, and it only accepts datagrams from the socket's peer. If there are more bytes in the datagram than remain in the given buffers then the remainder of the datagram is silently discarded. Otherwise this method behaves exactly as specified in the ScatteringByteChannel interface.

Java documentation for java.nio.channels.DatagramChannel.read(java.nio.ByteBuffer[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Java.Nio.Channels.IScatteringByteChannel.Read(Java.Nio.ByteBuffer%5b%5d%2c+System.Int32%2c+System.Int32)>

Applies to

Read(ByteBuffer)

Reads a datagram from this channel.

[Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;)I", "GetRead_Ljava_nio_ByteBuffer_Handler")]
public abstract int Read (Java.Nio.ByteBuffer? dst);
[<Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;)I", "GetRead_Ljava_nio_ByteBuffer_Handler")>]
abstract member Read : Java.Nio.ByteBuffer -> int

Parameters

Returns

Implements

Attributes

Exceptions

if the channel is not connected yet.

if the channel is already closed.

if the channel is closed by another thread while this method is in operation.

if another thread interrupts the calling thread while the operation is in progress. The calling thread will have the interrupt state set and the channel will be closed.

some other I/O error occurs.

Remarks

Reads a datagram from this channel.

This method may only be invoked if this channel's socket is connected, and it only accepts datagrams from the socket's peer. If there are more bytes in the datagram than remain in the given buffer then the remainder of the datagram is silently discarded. Otherwise this method behaves exactly as specified in the ReadableByteChannel interface.

Java documentation for java.nio.channels.DatagramChannel.read(java.nio.ByteBuffer).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to