IMemStream

Input memory stream. Convenient for storing elements in a byte array

Members

Functions

put
void put(T val)

Put an element of type T into the stream

put
void put(T data)

Put a string into the stream

put
void put(T data)

Put a byte array into the stream

Properties

getBytes
ubyte[] getBytes [@property getter]

Returns a copy of underlying bytes

peekBytes
ubyte[] peekBytes [@property getter]

Returns underlying bytes. MAY LEAK REFERENCES

Examples

IMemStream m;
m.put!ubyte(10);
m.put!short(11);
m.put!int(14);
auto res = m.getBytes;
assert(res.length == 7);
assert(res[0] == 10);
assert(res[1] == 11);
assert(res[2] == 0);
assert(res[3] == 14);
assert(res[4] == 0);
assert(res[5] == 0);
assert(res[6] == 0);

Meta