tango.io.stream.Utf

License:

BSD style: see license.txt

Version:

Initial release: Nov 2007

Author:

Kris

UTF conversion streams, supporting cross-translation of char, wchar and dchar variants. For supporting endian variations, configure the appropriate EndianStream upstream of this one (closer to the source.)
class UtfInput(T, S) : InputFilter, InputFilter.Mutator
Streaming UTF converter. Type T is the target or destination type, while S is the source type. Both types are either char/wchar/dchar.
this(InputStream stream)
Create a buffered utf input converter.
size_t consume(T[] dst) [final]
Consume input of type T, and return the number of array elements comsumed.
Returns Eof upon end-of-flow.
size_t read(void[] dst) [override, final]
class UtfOutput(S, T) : OutputFilter, OutputFilter.Mutator
Streaming UTF converter. Type T is the target or destination type, while S is the source type. Both types are either char/wchar/dchar.
Note that the arguments are reversed from those of UtfInput.
this(OutputStream stream)
Create a buffered utf output converter.
size_t consume(const(S)[] dst) [final]
Consume input of type T, and return the number of array elements consumed.
Returns Eof upon end-of-flow.
size_t write(const(void)[] src) [override, final]
Write to the output stream from a source array. The provided src content is converted as necessary. Note that an attached output buffer must be at least four bytes wide to accommodate a conversion.
Returns the number of bytes consumed from src, which may be less than the quantity provided.