Creates a buffer specifying the chunk size. This should be the default constructor for re-used buffers and input buffers.
Creates a buffer from an array of data. The chunk size is set to the size of the array.
Indicates whether an array of length size or the given type can be read without any exceptions thrown.
Check whether the data of the buffer is equals to the given array.
Peeks a value using the given endianness.
Peeks some data using the system's endianness.
Peeks a varint.
Peeks some data (read it but without changing the buffer's index).
Peeks a varint.
Reads a value with the given endianness.
Reads a value using the system's endianness.
Reads an array using the given endianness.
Reads an array using the system's endianness.
Reads a varint.
Reads the amount of data requested.
Reads a varint.
Resets the buffer setting the index and its length to 0.
Writes data to buffer using the given endianness.
Writes data to the buffer using the system's endianness.
Writes an array using the given endianness.
Writes an array using the system's endianness.
Writes a varint.
Writes data at the given index.
Writes data to the buffer and expands if it is not big enough.
Writes a varint.
Gets the size of the data allocated by the buffer.
Sets new data and resets the index.
Gets the current write/read index of the buffer. The index can be set to 0 using the reset method.
Gets the length of the buffer.
t { import xbuffer.memory : xalloc; // a buffer can be garbage collected Buffer gc = new Buffer(16); // or manually allocated // alloc is a function provided by the xbuffer.memory module Buffer b = xalloc!Buffer(16); // the memory is realsed with free, which is called by the garbage // collector or by the `free` function in the `xbuffer.memory` module xfree(b);
Buffer for writing and reading binary data.