Copy

Copy algorithm do not transform data at all This is useful in cases of reading/writing data that may or may not be compressed. Using Copy allows that the same code handles both kind of streams.

Members

Functions

end
void end(CopyStream )
Undocumented in source. Be warned that the author may not have intended to support it.
initialize
CopyStream initialize()
Undocumented in source. Be warned that the author may not have intended to support it.
process
Flag!"streamEnded" process(CopyStream stream, Flag!"lastChunk" lastChunk)
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset(CopyStream stream)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

import test.util : generateRepetitiveData;
import std.array : join;

const len = 10_000;
const phrase = cast(const(ubyte)[]) "Some very repetitive phrase.\n";
const input = generateRepetitiveData(len, phrase).join();

/// copying with arbitrary chunk sizes on input and output
const cop1 = generateRepetitiveData(len, phrase, 1231).copy(234).join();
const cop2 = generateRepetitiveData(len, phrase, 296).copy(6712).join();

assert(input == cop1);
assert(input == cop2);

Meta