BinaryStream

Binary stream implementation backed by an array.

Constructors

this
this(T data, Endianness endianness)
Undocumented in source.

Members

Functions

mayRead
bool mayRead()

Checks if there are enough elements left in the data array to read T.

mayRead
bool mayRead(size_t size)

Checks if there are enough elements left in the data array to read.

peek
T peek()

Peeks at the next value from the stream of type T without advancing the stream position.

peek
T[] peek(size_t count)

Peeks at multiple values of type T from the stream without advancing the stream position.

peek
T peek()

Peeks an array of type T from the stream without advancing the stream position.

peekString
immutable(CHAR)[] peekString()

Reads a string from the stream considering the character width and prefixing without advancing the stream position.

put
void put(T val)

Writes the provided value to the stream without advancing the stream position.

put
void put(T val)

Writes multiple values of type T to the stream without advancing the stream position.

putString
void putString(immutable(CHAR)[] val)

Writes a string into the stream considering the character width and prefixing without advancing the stream position.

read
T read()

Reads the next value from the stream of type T.

read
T[] read(size_t count)

Reads multiple values of type T from the stream.

read
T read()

Reads an array of type T from the stream.

read
T read()

Reads data from a byte stream into a structured type based on specified field names and read kinds. Designed specifically for better control reading string and array fields.

read7EncodedInt
uint read7EncodedInt()

Reads an integer value encoded in 7 bits from the stream.

readPlasticized
T readPlasticized()

Reads a type from the stream using optional fields.

readString
immutable(CHAR)[] readString()

Reads a string from the stream considering the character width and prefixing.

seek
void seek(size_t offset)

Seeks to a new position in the stream based on the provided offset and seek direction.

step
void step(size_t count)

Moves the position in the stream by the size of type T.

stepUntil
void stepUntil(T val)

Moves the position in the stream forward by one until val is peeked.

write
void write(T val)

Writes the provided value to the stream.

write
void write(T val)

Writes multiple values of type T to the stream.

write7EncodedInt
void write7EncodedInt(uint val)

Writes an integer value encoded in 7 bits to the stream.

writeString
void writeString(immutable(CHAR)[] val)

Writes a string to the stream considering the character width and prefixing.

Variables

data
ubyte[] data;
Undocumented in source.
endianness
Endianness endianness;
Undocumented in source.
position
size_t position;
Undocumented in source.

Inherited Members

From IStream

mayRead
bool mayRead()
Undocumented in source.
mayRead
bool mayRead(size_t size)
Undocumented in source.
step
void step()
Undocumented in source.
seek
void seek(size_t offset)
Undocumented in source.
read
T read()
Undocumented in source.
read
T read(size_t count)
Undocumented in source.
read
T read()
Undocumented in source.
readString
immutable(CHAR)[] readString()
Undocumented in source.
peek
T peek()
Undocumented in source.
peek
T peek(size_t count)
Undocumented in source.
peek
T peek()
Undocumented in source.
peekString
immutable(CHAR)[] peekString()
Undocumented in source.
write
void write(T val)
Undocumented in source.
write
void write(T items)
Undocumented in source.
writeString
void writeString(immutable(CHAR)[] string)
Undocumented in source.
put
void put()
Undocumented in source.
put
void put(T items)
Undocumented in source.
putString
void putString(immutable(CHAR)[] string)
Undocumented in source.

Meta