read

expect abstract fun read(buf: ByteArray): Int(source)

Reads data from the File for which this stream belongs, into the provided array. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs.

Parameters

buf

The array to place data into.

Throws

If an I/O error occurs, or the stream is closed.


expect abstract fun read(buf: ByteArray, offset: Int, len: Int): Int(source)

Reads data from the File for which this stream belongs, into the provided array. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs.

Parameters

buf

The array to place data into.

offset

The index in buf to start placing data.

len

The number of bytes to place into buf, starting at index offset.

Throws

If an I/O error occurs, or the stream is closed.

IndexOutOfBoundsException

If offset or len are inappropriate.


expect abstract fun read(buf: ByteArray, position: Long): Int(source)

Reads data from the File for which this stream belongs, into the provided array. Bytes are read starting at the specified position. The FileStream.position will not be changed.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs at the specified position.

Parameters

buf

The array to place data into.

position

The file offset (from the start of the File) to begin reading at.

Throws

IllegalArgumentException

If position is less than 0.

If an I/O error occurs, or the stream is closed.


expect abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int(source)

Reads data from the File for which this stream belongs, into the provided array. Bytes are read starting at the specified position. The FileStream.position will not be changed.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs at the specified position.

Parameters

buf

The array to place data into.

offset

The index in buf to start placing data.

len

The number of bytes to place into buf, starting at index offset.

position

The file offset (from the start of the File) to begin reading at.

Throws

IllegalArgumentException

If position is less than 0.

IndexOutOfBoundsException

If offset or len are inappropriate.

If an I/O error occurs, or the stream is closed.

abstract fun read(buf: Buffer): Long(source)

Reads data from the File for which this stream belongs, into the provided buffer. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs.

Parameters

buf

The buffer to place data into.

Throws

If an I/O error occurs, or the stream is closed.


abstract fun read(buf: Buffer, offset: Long, len: Long): Long(source)

Reads data from the File for which this stream belongs, into the provided buffer. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs.

Parameters

buf

The buffer to place data into.

offset

The index in buf to start placing data.

len

The number of bytes to place into buf, starting at index offset.

Throws

If an I/O error occurs, or the stream is closed.

IndexOutOfBoundsException

If offset or len are inappropriate.


abstract fun read(buf: Buffer, position: Long): Long(source)

Reads data from the File for which this stream belongs, into the provided buffer. Bytes are read starting at the specified position. The FileStream.position will not be changed.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs at the specified position.

Parameters

buf

The buffer to place data into.

position

The file offset (from the start of the File) to begin reading at.

Throws

IllegalArgumentException

If position is less than 0.

If an I/O error occurs, or the stream is closed.


abstract fun read(buf: Buffer, offset: Long, len: Long, position: Long): Long(source)

Reads data from the File for which this stream belongs, into the provided buffer. Bytes are read starting at the specified position. The FileStream.position will not be changed.

Return

The number of bytes read into buf, or -1 if no more data is available from the File for which this Read stream belongs at the specified position.

Parameters

buf

The buffer to place data into.

offset

The index in buf to start placing data.

len

The number of bytes to place into buf, starting at index offset.

position

The file offset (from the start of the File) to begin reading at.

Throws

IllegalArgumentException

If position is less than 0.

IndexOutOfBoundsException

If offset or len are inappropriate.

If an I/O error occurs, or the stream is closed.


actual abstract fun read(buf: ByteArray): Int(source)
actual abstract fun read(buf: ByteArray, offset: Int, len: Int): Int(source)
actual abstract fun read(buf: ByteArray, position: Long): Int(source)
actual abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int(source)
abstract override fun read(dst: ByteBuffer?): Int(source)

Reads data from the File for which this stream belongs, into the provided ByteBuffer. Bytes are read starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that have been read.

Otherwise, this function behaves as specified in ReadableByteChannel.


abstract fun read(dst: ByteBuffer?, position: Long): Int(source)

Reads data from the File for which this stream belongs, into the provided ByteBuffer. Bytes are read starting at the specified position. The FileStream.position will not be changed.

Otherwise, this function behaves exactly like the positional java.nio.channels.FileChannel.read function.

Parameters

dst

The buffer to place data into.

position

The file offset (from the start of the File) to begin reading at.

Throws

IllegalArgumentException

If position is less than 0.

If an I/O error occurs.


actual abstract fun read(buf: ByteArray): Int(source)
actual abstract fun read(buf: ByteArray, offset: Int, len: Int): Int(source)
actual abstract fun read(buf: ByteArray, position: Long): Int(source)
actual abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int(source)
actual abstract fun read(buf: ByteArray): Int(source)
actual abstract fun read(buf: ByteArray, offset: Int, len: Int): Int(source)
actual abstract fun read(buf: ByteArray, position: Long): Int(source)
actual abstract fun read(buf: ByteArray, offset: Int, len: Int, position: Long): Int(source)