DigestOutput

Inject a digest filter into an output stream, updating the digest as information flows through it. Here's an example where we calculate an MD5 digest as a side-effect of copying a file:

auto output = new DigestOutput(new FileOutput("output"), new Md5);
output.copy (new FileInput("input"));

Stdout.formatln ("hex digest: {}", output.digest.hexDigest);

Constructors

this
this(OutputStream stream, Digest digest)

Accepts any output stream, and any digest derivation.

Members

Functions

digest
Digest digest()

Return the Digest instance we were created with. Use this to access the resultant binary or hex digest value.

write
size_t write(const(void)[] src)

Write to conduit from a source array. The provided src content will be written to the conduit.

Inherited Members

From OutputFilter

sink
OutputStream sink;
Undocumented in source.
conduit
IConduit conduit [@property getter]

Return the hosting conduit.

write
size_t write(const(void)[] src)

Write to conduit from a source array. The provided src content will be written to the conduit.

copy
OutputStream copy(InputStream src, size_t max)

Transfer the content of another conduit to this one. Returns a reference to this class, or throws IOException on failure.

flush
IOStream flush()

Emit/purge buffered content.

seek
long seek(long offset, Anchor anchor)

Seek on this stream. Target conduits that don't support seeking will throw an IOException.

output
OutputStream output [@property getter]

Return the upstream host of this filter.

close
void close()

Close the output.

Meta