Base64Impl.decoder

Construct a Decoder that iterates over the decoding of the given Base64 encoded data.

template Base64Impl(char Map62th, char Map63th, char Padding = '=')
Decoder!(Range)
decoder
(
Range
)
(
Range range
)
if ()

Parameters

range Range

An input range over the data to be decoded.

Return Value

Type: Decoder!(Range)

If range is a range of characters, a Decoder that iterates over the bytes of the corresponding Base64 decoding.

If range is a range of ranges of characters, a Decoder that iterates over the decoded strings corresponding to each element of the range. In this case, the length of each subrange must be a multiple of 4; the returned decoder does not keep track of Base64 decoding state across subrange boundaries.

In both cases, the returned Decoder will be a forward range if the given range is at least a forward range, otherwise it will be only an input range.

If the input data contains characters not found in the base alphabet of the current Base64 encoding scheme, the returned range may throw a Base64Exception.

Examples

This example shows decoding over a range of input data lines.

foreach (decoded; Base64.decoder(stdin.byLine()))
{
    writeln(decoded);
}

This example shows decoding one byte at a time.

auto encoded = Base64.encoder(cast(ubyte[])"0123456789");
foreach (n; map!q{a - '0'}(Base64.decoder(encoded)))
{
    writeln(n);
}
Suggestion Box / Bug Report