*
std.outbuffer
Serialize data to ubyte arrays.
*
Copyright
Copyright The D Language Foundation 2000 - 2015.
class OutBuffer
Types 1
classOutBuffer
OutBuffer provides a way to build up an array of bytes out of raw data. It is useful for things like preparing an array of bytes to write out to a file. OutBuffer's byte order is the format native to the computer. To control the byte order (endianness), use a class derived from OutBuffer.
OutBuffer's internal buffer is allocated with the GC. Pointers stored into the buffer are scanned by the GC, but you have to ensure proper alignment, e.g. by using alignSize((void*).sizeof).
Fields
ubyte[] datasize_t offsetMethods
void reserve(size_t nbytes) pure nothrow @safe @trustedPreallocate nbytes more to the size of the internal buffer.void fill(size_t nbytes, ubyte val = 0) pure nothrow @safeAppend nbytes of val to the internal buffer. Params: nbytes = Number of bytes to fill. val = Value to fill, defaults to 0.void fill0(size_t nbytes) pure nothrow @safeAppend nbytes of 0 to the internal buffer. Param: nbytes - number of bytes to fill.void alignSize(size_t alignsize, ubyte val = 0) pure nothrow @safeAppend bytes until the buffer aligns on a power of 2 boundary.void align2(ubyte val = 0) pure nothrow @safeOptimize common special case alignSize(2) Params: val = Value to fill, defaults to 0.void align4(ubyte val = 0) pure nothrow @safeOptimize common special case alignSize(4) Params: val = Value to fill, defaults to 0.void vprintf(scope string format, va_list args) @system nothrowAppend output of C's vprintf() to internal buffer.void writef(Char, A...)(scope const(Char)[] fmt, A args)Formats and writes its arguments in text format to the OutBuffer.void writef(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))dittovoid writefln(Char, A...)(scope const(Char)[] fmt, A args)Formats and writes its arguments in text format to the OutBuffer, followed by a newline.void writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))dittovoid spread(size_t index, size_t nbytes) pure nothrow @safeAt offset index into buffer, create nbytes of space by shifting upwards all data past index.