ByteStreamImpl

Struct for wrapping a ubyte[] with read functions and endianness.

Constructors

this
this(ubyte[] data)

Sets the stream to data.

Alias This

stream

Members

Functions

append
void append(T data)

Appends data to the stream.

opAssign
void opAssign(ubyte[] data)

Sets the stream to data.

peek
T peek(size_t index = 0)

Returns T.sizeof bytes from the stream at position index without advancing the stream.

peek
T[] peek(size_t index, size_t length)

Returns a T[] from the stream.

read
T read()

Returns the first T.sizeof bytes from the stream and advances the stream.

read
T[] read(size_t length)

Returns a T[] from the stream and advances the stream.

readTo
T readTo(ubyte value)

Reads until value is value and returns everything read excluding value. Advances after found value. Returns null if value was not found.

readToIncluding
T readToIncluding(ubyte value)

Reads until value is value and returns everything read including value. Advances after found value. Returns null if value was not found.

skip
void skip(size_t amount)

Advances the stream by amount bytes.

write
void write(T data, size_t index)

Writes data to the stream at position index.

Variables

stream
ubyte[] stream;

Contains the data.

Meta