A simple way to write binary data to an arbitrary OutputStream,
such as a file:
auto output = new DataOutput (new File ("path", File.WriteCreate));
output.int32 (1024);
output.float64 (3.14159);
output.array ("string with length prefix");
output.write ("raw array, no prefix");
output.close;
Examples:
auto buf = new Array(32);
auto output = new DataOutput (buf);
output.array ("blah blah".dup);
output.int32 (1024);
auto input = new DataInput (buf);
assert (input.array(new char[9]) is 9);
assert (input.int32() is 1024);
- alias put = array;
alias putBool = boolean;
alias putByte = int8;
alias putShort = int16;
alias putInt = int32;
alias putLong = int64;
alias putFloat = float32;
alias putFloat = float64;
- Old name aliases.
- Native
- Network
- Big
- Little
- this(OutputStream stream);
- Propagate ctor to superclass.
- final DataOutput endian(int e);
- Set current endian translation.
- final ulong array(const(void)[] src);
- Write an array to the target stream. Note that the size
of the array is written as an integer prefixing the array
content itself. Use write(void[]) to eschew this prefix.
- final void boolean(bool x);
- final void int8(byte x);
- final void int16(short x);
- final void int32(int x);
- final void int64(long x);
- final void float32(float x);
- final void float64(double x);
- final size_t write(const(void)[] data);