SearchableCursor

A Cursor whose size is known and that can seek to arbitrary positions, including backwards.

package
interface SearchableCursor : Cursor {}

Members

Functions

seek
void seek(ulong pos)

Seek to a new position (relative to beginning)

Properties

size
ulong size [@property getter]

Complete size of the data

Inherited Members

From Cursor

name
string name [@property getter]

The name of the data source For FileCursor, this will be the filename, otherwise a description of the type of data.

pos
ulong pos [@property getter]

Position in the stream (how many bytes read so far)

eoi
bool eoi [@property getter]

Whether end-of-input was reached

ffw
void ffw(ulong dist)

Fast-forward and discard dist bytes. Passing size_t.max will exhaust the input.

get
ubyte get()

Reads a single byte

getValue
T getValue()

Get a value of type T. Is a convenience over readValue.

read
ubyte[] read(ubyte[] buffer)

Read up to buffer.length bytes into buffer and return what was read. Returns a smaller slice only if EOI was reached.

readValue
void readValue(T* val)

Read T.sizeof data and returns it as a T. Similar to get!T but the value is passed as pointer to be filled in. Prefer this form for greater values (e.g. dozens of bytes)

read
T[] read(T[] buffer)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta