Java.Nio.Channels.FileChannel.Write Method
Writes bytes from the given buffer to this file channel starting at the given file position.

Syntax

[Android.Runtime.Register("write", "(Ljava/nio/ByteBuffer;J)I", "GetWrite_Ljava_nio_ByteBuffer_JHandler")]
public abstract int Write (Java.Nio.ByteBuffer buffer, long position)

Parameters

buffer
the buffer containing the bytes to be written.
position
the (non-negative) position at which to write the bytes.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.IllegalArgumentExceptionif position is less than 0.
Java.Nio.Channels.ClosedChannelExceptionif this channel is closed.
Java.Nio.Channels.NonWritableChannelExceptionif the channel was not opened in write-mode.
Java.Nio.Channels.AsynchronousCloseExceptionif this channel is closed by another thread while this method is executing.
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.IO.IOExceptionif another I/O error occurs.

Remarks

Writes bytes from the given buffer to this file channel starting at the given file position.

The bytes are written starting at the given file position (up to the remaining number of bytes in the buffer). The number of bytes actually written is returned.

If the position is beyond the current end of file, then the file is first extended up to the given position by the required number of unspecified byte values.

Note that the file position is not modified by this method.

[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