std.base64.Base64Impl.Encoder/encoder
- multiple declarations
Function Base64Impl.encoder
Construct an Encoder
that iterates over the Base64 encoding of the
given input range.
Parameters
Name | Description |
---|---|
range | An input range over the data to be encoded. |
Returns
If range is a range of bytes, an Encoder
that iterates
over the bytes of the corresponding Base64 encoding.
If range is a range of ranges of bytes, an Encoder
that
iterates over the Base64 encoded strings of each element of the range.
In both cases, the returned Encoder
will be a
forward range if the
given range
is at least a forward range, otherwise it will be only
an input range.
Example
This example encodes the input one line at a time.
File f = File("text.txt", "r");
scope(exit) f .close();
uint line = 0;
foreach (encoded; Base64 .encoder(f .byLine()))
{
writeln(++line, ". ", encoded);
}
Example
This example encodes the input data one byte at a time.
ubyte[] data = cast(ubyte[]) "0123456789";
// The ElementType of data is not aggregation type
foreach (encoded; Base64 .encoder(data))
{
writeln(encoded);
}
Struct Base64Impl.Encoder
An input range that iterates over the encoded bytes of the given source data.
struct Encoder(Range)
if (isInputRange!Range && is(ElementType!Range : ubyte));
It 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) | Save the current iteration state of the range. |
Methods
Name | Description |
---|---|
popFront
()
|
Advance to the next encoded character. |
Note
This struct is not intended to be created in user code directly;
use the encoder
function instead.
Struct Base64Impl.Encoder
An input range that iterates over the respective Base64 encodings of a range of data items.
struct Encoder(Range)
if (isInputRange!Range && (is(ElementType!Range : const(ubyte)[]) || is(ElementType!Range : const(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]
|
char[] | |
save [get]
|
typeof(this) | Save the current iteration state of the range. |
Methods
Name | Description |
---|---|
popFront
()
|
Advance the range to the next chunk of encoded data. |
Note
This struct is not intended to be created in user code directly;
use the encoder
function instead.
Authors
Masahiro Nakagawa, Daniel Murphy (Single value Encoder and Decoder)