AsynchronousFileChannel.Read Method

Definition

Overloads

Read(ByteBuffer, Int64)

Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.

Read(ByteBuffer, Int64, Object, ICompletionHandler)

Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.

Read(ByteBuffer, Int64)

Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.

[Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;J)Ljava/util/concurrent/Future;", "GetRead_Ljava_nio_ByteBuffer_JHandler", ApiSince=26)]
public abstract Java.Util.Concurrent.IFuture? Read (Java.Nio.ByteBuffer? dst, long position);
[<Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;J)Ljava/util/concurrent/Future;", "GetRead_Ljava_nio_ByteBuffer_JHandler", ApiSince=26)>]
abstract member Read : Java.Nio.ByteBuffer * int64 -> Java.Util.Concurrent.IFuture

Parameters

dst
ByteBuffer

The buffer into which bytes are to be transferred

position
Int64

The file position at which the transfer is to begin; must be non-negative

Returns

A Future object representing the pending result

Attributes

Remarks

Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.

This method initiates the reading of a sequence of bytes from this channel into the given buffer, starting at the given file position. This method returns a Future representing the pending result of the operation. The Future's Future#get() get method returns the number of bytes read or -1 if the given position is greater than or equal to the file's size at the time that the read is attempted.

This method works in the same manner as the AsynchronousByteChannel#read(ByteBuffer) method, except that bytes are read starting at the given file position. If the given file position is greater than the file's size at the time that the read is attempted then no bytes are read.

Java documentation for java.nio.channels.AsynchronousFileChannel.read(java.nio.ByteBuffer, long).

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.

Applies to

Read(ByteBuffer, Int64, Object, ICompletionHandler)

Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.

[Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;JLjava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "GetRead_Ljava_nio_ByteBuffer_JLjava_lang_Object_Ljava_nio_channels_CompletionHandler_Handler", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "A" })]
public abstract void Read (Java.Nio.ByteBuffer? dst, long position, Java.Lang.Object? attachment, Java.Nio.Channels.ICompletionHandler? handler);
[<Android.Runtime.Register("read", "(Ljava/nio/ByteBuffer;JLjava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "GetRead_Ljava_nio_ByteBuffer_JLjava_lang_Object_Ljava_nio_channels_CompletionHandler_Handler", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "A" })>]
abstract member Read : Java.Nio.ByteBuffer * int64 * Java.Lang.Object * Java.Nio.Channels.ICompletionHandler -> unit

Parameters

dst
ByteBuffer

The buffer into which bytes are to be transferred

position
Int64

The file position at which the transfer is to begin; must be non-negative

attachment
Object

The object to attach to the I/O operation; can be null

handler
ICompletionHandler

The handler for consuming the result

Attributes

Remarks

Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.

This method initiates the reading of a sequence of bytes from this channel into the given buffer, starting at the given file position. The result of the read is the number of bytes read or -1 if the given position is greater than or equal to the file's size at the time that the read is attempted.

This method works in the same manner as the AsynchronousByteChannel#read(ByteBuffer,Object,CompletionHandler) method, except that bytes are read starting at the given file position. If the given file position is greater than the file's size at the time that the read is attempted then no bytes are read.

Java documentation for java.nio.channels.AsynchronousFileChannel.read(java.nio.ByteBuffer, long, A, java.nio.channels.CompletionHandler<java.lang.Integer, ? super A>).

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.

Applies to