Reader

abstract inner class Reader(source)

Reads the Xof snapshot.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
@get:JvmName(name = "bytesRead")
val bytesRead: Long

The total amount of bytes read for this Reader instance.

Link copied to clipboard
@get:JvmName(name = "isClosed")
var isClosed: Boolean

If the reader is closed or not

Functions

Link copied to clipboard
fun close()

Closes the Reader, rendering it no-longer usable for reads. Attempting to read again after closure will result in an IllegalStateException being thrown.

Link copied to clipboard
protected abstract fun closeProtected()
Link copied to clipboard
fun read(out: ByteArray): Int

Reads the Xof snapshot's state for when Reader was produced, filling the provided out array completely.

fun read(out: ByteArray, offset: Int, len: Int): Int

Reads the Xof snapshot's state for when Reader was produced, filling the provided out array for specified offset and len arguments.

Link copied to clipboard
protected abstract fun readProtected(out: ByteArray, offset: Int, len: Int): Int
Link copied to clipboard
inline fun <T> use(action: Xof.Reader<A>.() -> T): T

Helper function which automatically invokes close once action completes.