tango.io.stream.Endian

License:
BSD style:

Version:
Initial release: Nov 2007

author:
Kris

Streams for swapping endian-order. The stream is treated as a set of same-sized elements. Note that partial elements are not mutated.

class EndianInput(T): InputFilter, InputFilter.Mutator;
Type T is the element type.

this(InputStream stream);


size_t read(void[] dst);
Read from conduit into a target array. The provided dst will be populated with content from the conduit.

Returns the number of bytes read, which may be less than requested in dst (or IOStream.Eof for end-of-flow). Note that a trailing partial element will be placed into dst, but the returned length will effectively ignore it.

class EndianOutput(T): OutputFilter, OutputFilter.Mutator;
Type T is the element type.

Examples:
auto inp = new EndianInput!(dchar)(new Array("hello world"d.dup));
auto oot = new EndianOutput!(dchar)(new Array(64));
oot.copy (inp);
assert (oot.output.slice() == "hello world"d);


this(OutputStream stream);


size_t write(const(void)[] src);
Write to output stream from a source array. The provided src content will be consumed and left intact.

Returns the number of bytes written from src, which may be less than the quantity provided. Note that any partial elements will not be consumed.


Page generated by Ddoc. Copyright (c) 2007 Kris Bell. All rights reserved