tango.io.stream.Typed

License:
BSD style:

Version:
Initial release: Nov 2007

author:
Kris

Streams to expose simple native types as discrete elements. I/O is buffered and should yield fair performance.

class TypedInput(T): InputFilter;
Type T is the target or destination type.

this(InputStream stream);


TypedInput flush();
Override this to give back a useful chaining reference.

bool read(ref T x);
Read a value from the stream. Returns false when all content has been consumed.

int opApply(scope int delegate(ref T x) dg);
Iterate over all content.

class TypedOutput(T): OutputFilter;
Type T is the target or destination type.

Examples:
Array output;

auto inp = new TypedInput!(char)(new Array("hello world".dup));
auto oot = new TypedOutput!(char)(output = new Array(20));

foreach (x; inp)
         oot.write (x);
assert (output.slice() == "hello world");

auto xx = new TypedInput!(char)(new UtfInput!(char, dchar)(new Array("hello world"d.dup)));
char[] yy;
foreach (x; xx)
         yy ~= x;
assert (yy == "hello world");


this(OutputStream stream);


void write(ref T x);
Append a value to the output stream.


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