std.base64.Base64Impl.Decoder/decoder
- multiple declarations
Function Base64Impl.decoder
Construct a Decoder
that iterates over the decoding of the given
Base64 encoded data.
Parameters
Name | Description |
---|---|
range | An input range over the data to be decoded. |
Returns
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
.
Example
This example shows decoding over a range of input data lines.
foreach (decoded; Base64 .decoder(stdin .byLine()))
{
writeln(decoded);
}
Example
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);
}
Struct Base64Impl.Decoder
An input range that iterates over the bytes of data decoded from a Base64 encoded string.
struct Decoder(Range)
if (isInputRange!Range && is(ElementType!Range : char));
This range will be a forward range if the underlying data source is at least a forward range.
Properties
Name | Type | Description |
---|---|---|
empty [get]
|
bool | |
front [get]
|
ubyte | |
save [get]
|
typeof(this) | Saves the current iteration state. |
Methods
Name | Description |
---|---|
popFront
|
Advance to the next decoded byte. |
Note
This struct is not intended to be created in user code directly;
use the decoder
function instead.
Struct Base64Impl.Decoder
An input range that iterates over the decoded data of a range of Base64 encodings.
struct Decoder(Range)
if (isInputRange!Range && (is(ElementType!Range : const(char)[]) || is(ElementType!Range : const(ubyte)[])));
This range will be a forward range if the underlying data source is at least a forward range.
Properties
Name | Type | Description |
---|---|---|
empty [get]
|
bool | |
front [get]
|
ubyte[] | |
save [get]
|
typeof(this) | Saves the current iteration state. |
Methods
Name | Description |
---|---|
popFront
|
Advance to the next element in the input to be decoded. |
Note
This struct is not intended to be created in user code directly;
use the decoder
function instead.
Authors
Masahiro Nakagawa, Daniel Murphy (Single value Encoder and Decoder)