Java.Nio.Channels.SocketChannel.Read Method
Reads bytes from this socket channel into the given buffer.

Syntax

[Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;)I", "GetRead_Ljava_nio_ByteBuffer_Handler")]
public abstract int Read (Java.Nio.ByteBuffer target)

See Also

IReadableByteChannel.Read(Java.Nio.ByteBuffer)

Parameters

target
the byte buffer to receive the bytes.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Nio.Channels.AsynchronousCloseExceptionif another thread closes the channel during the read.
Java.Nio.Channels.NotYetConnectedExceptionif this channel is not yet connected.
Java.Nio.Channels.ClosedByInterruptExceptionif another thread interrupts the calling thread while this operation is in progress. The interrupt state of the calling thread is set and the channel is closed.
Java.Nio.Channels.ClosedChannelExceptionif this channel is closed.
Java.IO.IOExceptionif another I/O error occurs.

Remarks

Reads bytes from this socket channel into the given buffer.

The maximum number of bytes that will be read is the remaining number of bytes in the buffer when the method is invoked. The bytes will be copied into the buffer starting at the buffer's current position.

The call may block if other threads are also attempting to read from this channel.

Upon completion, the buffer's position is set to the end of the bytes that have been read. The buffer's limit is not changed.

[Android Documentation]

Requirements

Namespace: Java.Nio.Channels
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1