MemoryStream now constructed in UTFDecoder.

This commit is contained in:
Ferdinand Majerech 2014-07-22 02:15:33 +02:00
parent e525ac120a
commit c296a6e790

View file

@ -102,7 +102,7 @@ final class Reader
} }
version(unittest) { endian_ = result.endian; } version(unittest) { endian_ = result.endian; }
decoder_ = UTFFastDecoder(new MemoryStream(result.array), result.encoding); decoder_ = UTFFastDecoder(result.array, result.encoding);
} }
@trusted nothrow @nogc ~this() @trusted nothrow @nogc ~this()
@ -421,10 +421,10 @@ struct UTFBlockDecoder(size_t bufferSize_) if (bufferSize_ % 2 == 0)
dchar[] buffer_; dchar[] buffer_;
public: public:
/// Construct a UTFBlockDecoder decoding a stream. /// Construct a UTFBlockDecoder decoding data from a buffer.
this(MemoryStream stream, UTFEncoding encoding) @trusted this(ubyte[] buffer, UTFEncoding encoding) @trusted
{ {
stream_ = stream; stream_ = new MemoryStream(buffer);
available_ = stream_.available; available_ = stream_.available;
encoding_ = encoding; encoding_ = encoding;
final switch(encoding_) final switch(encoding_)