Share via


AsynchronousFileChannel.Write Method

Definition

Overloads

Write(ByteBuffer, Int64)

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

Write(ByteBuffer, Int64, Object, ICompletionHandler)

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

Write(ByteBuffer, Int64)

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

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

Parameters

src
ByteBuffer

The buffer from 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

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

This method initiates the writing of a sequence of bytes to this channel from the given buffer, starting at the given file position. The method returns a Future representing the pending result of the write operation. The Future's Future#get() get method returns the number of bytes written.

This method works in the same manner as the AsynchronousByteChannel#write(ByteBuffer) method, except that bytes are written starting at the given file position. If the given position is greater than the file's size, at the time that the write is attempted, then the file will be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.

Java documentation for java.nio.channels.AsynchronousFileChannel.write(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

Write(ByteBuffer, Int64, Object, ICompletionHandler)

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

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

Parameters

src
ByteBuffer

The buffer from 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

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

This method works in the same manner as the AsynchronousByteChannel#write(ByteBuffer,Object,CompletionHandler) method, except that bytes are written starting at the given file position. If the given position is greater than the file's size, at the time that the write is attempted, then the file will be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.

Java documentation for java.nio.channels.AsynchronousFileChannel.write(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