position

open fun position(): Long

Returns the current position as a positive number of bytes from the start of the underlying data source.

Throws

if this channel is closed.

if another I/O error occurs.


open fun position(newPosition: Long): SeekableByteChannel

Sets the channel's position to newPosition.

The argument is the number of bytes counted from the start of the data source. The position cannot be set to a value that is negative. The new position can be set beyond the current size. If set beyond the current size, attempts to read will return end-of-file. Write operations will succeed but they will fill the bytes between the current end of the data source and the new position with the required number of (unspecified) byte values.

Return

the channel.

Throws

if the new position is negative.

if this channel is closed.

if another I/O error occurs.