DataOutput

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;

Constructors

this
this(OutputStream stream)

Propagate ctor to superclass.

Members

Aliases

put
alias put = array
Undocumented in source.
putBool
alias putBool = boolean
Undocumented in source.
putByte
alias putByte = int8
Undocumented in source.
putFloat
alias putFloat = float32
Undocumented in source.
putFloat
alias putFloat = float64
Undocumented in source.
putInt
alias putInt = int32
Undocumented in source.
putLong
alias putLong = int64
Undocumented in source.
putShort
alias putShort = int16
Undocumented in source.

Enums

Native
anonymousenum Native

Endian variations.

Functions

array
uint 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.

boolean
void boolean(bool x)
endian
DataOutput endian(int e)

Set current endian translation.

float32
void float32(float x)
float64
void float64(double x)
int16
void int16(short x)
int32
void int32(int x)
int64
void int64(long x)
int8
void int8(byte x)
write
size_t write(const(void)[] data)

Inherited Members

From OutputFilter

sink
OutputStream sink;
Undocumented in source.
conduit
IConduit conduit()

Return the hosting conduit.

write
size_t write(const(void)[] src)

Write to conduit from a source array. The provided src content will be written to the conduit.

copy
OutputStream copy(InputStream src, size_t max)

Transfer the content of another conduit to this one. Returns a reference to this class, or throws IOException on failure.

flush
IOStream flush()

Emit/purge buffered content.

seek
long seek(long offset, Anchor anchor)

Seek on this stream. Target conduits that don't support seeking will throw an IOException.

output
OutputStream output()

Return the upstream host of this filter.

close
void close()

Close the output.

Meta