Java.Nio.Channels.IReadableByteChannel.Read Method
Reads bytes from the channel into the given buffer.

Syntax

[Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;)I", "GetRead_Ljava_nio_ByteBuffer_Handler:Java.Nio.Channels.IReadableByteChannelInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int Read (Java.Nio.ByteBuffer buffer)

Parameters

buffer
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.ClosedByInterruptExceptionif another thread interrupts the calling thread while the operation is in progress. The interrupt state of the calling thread is set and the channel is closed.
Java.Nio.Channels.ClosedChannelExceptionif the channel is closed.
Java.IO.IOExceptionanother I/O error occurs, details are in the message.
Java.Nio.Channels.NonReadableChannelExceptionif the channel was not opened for reading.

Remarks

Reads bytes from the channel into the given buffer.

The maximum number of bytes that will be read is the Java.Nio.Buffer.Remaining number of bytes in the buffer when the method is invoked. The bytes will be read into the buffer starting at the buffer's current Java.Nio.Buffer.Position.

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

Upon completion, the buffer's position is updated to the end of the bytes that were read. The buffer's Java.Nio.Buffer.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