FileChannel.Position Method

Definition

Overloads

Position()

Returns this channel's file position.

Position(Int64)

Sets this channel's file position.

Position()

Returns this channel's file position.

[Android.Runtime.Register("position", "()J", "GetPositionHandler")]
public abstract long Position ();
[<Android.Runtime.Register("position", "()J", "GetPositionHandler")>]
abstract member Position : unit -> int64

Returns

This channel's file position, a non-negative integer counting the number of bytes from the beginning of the file to the current position

Implements

Attributes

Exceptions

if this channel is closed.

if another I/O error occurs.

Remarks

Returns this channel's file position.

Java documentation for java.nio.channels.FileChannel.position().

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

Position(Int64)

Sets this channel's file position.

[Android.Runtime.Register("position", "(J)Ljava/nio/channels/FileChannel;", "GetPosition_JHandler")]
public abstract Java.Nio.Channels.FileChannel? Position (long newPosition);
[<Android.Runtime.Register("position", "(J)Ljava/nio/channels/FileChannel;", "GetPosition_JHandler")>]
abstract member Position : int64 -> Java.Nio.Channels.FileChannel

Parameters

newPosition
Int64

The new position, a non-negative integer counting the number of bytes from the beginning of the file

Returns

This file channel

Attributes

Exceptions

if the new position is negative.

if this channel is closed.

if another I/O error occurs.

Remarks

Sets this channel's file position.

Setting the position to a value that is greater than the file's current size is legal but does not change the size of the file. A later attempt to read bytes at such a position will immediately return an end-of-file indication. A later attempt to write bytes at such a position will cause the file to 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.FileChannel.position(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