std.outbuffer
License:Boost License 1.0. Authors:
Walter Bright Source:
std/outbuffer.d
- 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.
- Convert to array of bytes.
- Preallocate nbytes more to the size of the internal buffer. This is a speed optimization, a good guess at the maximum size of the resulting buffer will improve performance by eliminating reallocations and copying.
- void write(const(ubyte)[] bytes);
void write(ubyte b);
void write(byte b);
void write(char c);
void write(dchar c);
void write(ushort w);
void write(short s);
void write(wchar c);
void write(uint w);
void write(int i);
void write(ulong l);
void write(long l);
void write(float f);
void write(double f);
void write(real f);
void write(in char[] s);
void write(OutBuffer buf); - Append data to the internal buffer.
- Append nbytes of 0 to the internal buffer.
- 0-fill to align on power of 2 boundary.
- Optimize common special case alignSize(2)
- Optimize common special case alignSize(4)
- Convert internal buffer to array of chars.
- Append output of C's vprintf() to internal buffer.
- Append output of C's printf() to internal buffer.
- At offset index into buffer, create nbytes of space by shifting upwards all data past index.