d2d.core.bytestream



struct ByteStreamImpl(Endian endianness);
Struct for wrapping a ubyte[] with read functions and endianness.

ubyte[] stream;
Contains the data.

this(ubyte[] data);
Sets the stream to data.

void opAssign(ubyte[] data);
Sets the stream to data.

void skip(size_t amount);
Advances the stream by
amount
bytes.

T read(T = ubyte)();
Returns the first
T.sizeof
bytes from the stream and advances the stream.

T[] read(T = ubyte)(size_t length);
Returns a
T[]
from the stream and advances the stream.

T readTo(T)(ubyte value);
Reads until value is
value
and returns everything read excluding
value
. Advances after found
value
. Returns
null
if
value
was not found.

T readToIncluding(T)(ubyte value);
Reads until value is
value
and returns everything read including
value
. Advances after found
value
. Returns
null
if
value
was not found.

T peek(T = ubyte)(size_t index = 0);
Returns
T.sizeof
bytes from the stream at position
index
without advancing the stream.

T[] peek(T = ubyte)(size_t index, size_t length);
Returns a
T[]
from the stream.

void write(T)(T data, size_t index);
Writes
data
to the stream at position
index
.

void append(T)(T data);
Appends
data
to the stream.


Page generated by Ddoc.