www.digitalmars.com Home | Search | D | Comments
Last update Mon Aug 22 2005
D
Language
Phobos
Comparisons


object

std
 std.base64
 std.boxer
 std.compiler
 std.conv
 std.ctype
 std.date
 std.file
 std.format
 std.gc
 std.intrinsic
 std.math
 std.md5
 std.mmfile
 std.openrj
 std.outbuffer
 std.path
 std.process
 std.random
 std.recls
 std.regexp
 std.socket
 std.socketstream
 std.stdint
 std.stdio
 std.cstream
 std.stream
 std.string
 std.system
 std.thread
 std.uri
 std.utf
 std.zip
 std.zlib

std.windows

std.linux

std.c
 std.c.stdio

std.c.windows

std.c.linux

std.outbuffer

class OutBuffer
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. To convert an array of bytes back into raw data, use InBuffer.

void reserve(uint nbytes)
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(ubyte[] bytes)
void write(ubyte b)
void write(byte b)
void write(char 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(char[] s)
void write(OutBuffer buf)
Append data to the internal buffer.

void fill0(uint nbytes)
Append nbytes of 0 to the internal buffer.

void alignSize(uint alignsize)
0-fill to align on an alignsize boundary. alignsize must be a power of 2.

void align2()
Optimize common special case alignSize(2)

void align4()
Optimize common special case alignSize(4)

ubyte[] toBytes()
Convert internal buffer to array of bytes.

char[] toString()
Convert internal buffer to array of chars.

void vprintf(char[] format, va_list args)
Append output of vprintf() to internal buffer.

void printf(char[] format, ...)
Append output of printf() to internal buffer.

void spread(uint index, uint nbytes)
At offset index into buffer, create nbytes of space by shifting upwards all data past index.

Feedback and Comments

Add feedback and comments regarding this page.
Copyright © 1999-2005 by Digital Mars, All Rights Reserved