Base64 encoder and decoder.
More...
#include <tsBase64.h>
|
static constexpr size_t | BIN_BLOCK_SIZE = 3 |
| Base64 input bytes block size.
|
|
static constexpr size_t | DEFAULT_LINE_SIZE = 76 |
| Default output line size.
|
|
static constexpr UChar | PAD_CHAR = u'=' |
| Base64 padding character at end of stream.
|
|
static constexpr size_t | STR_BLOCK_SIZE = 4 |
| Base64 output characters block size.
|
|
Base64 encoder and decoder.
◆ Base64()
Constructor.
- Parameters
-
[in] | line_size | Output text line size, when producing encoded Base64. When zero, do not generate new-line characters. |
◆ encodeAdd()
void ts::Base64::encodeAdd |
( |
UString & |
b64, |
|
|
const void * |
data, |
|
|
size_t |
size |
|
) |
| |
Encode binary data and return partial Base64 string.
Some input data may be internally kept, waiting for more data to encode. Call encodeTerminate() to properly terminate the encoding of data.
- Parameters
-
[in,out] | b64 | Output string. Produced characters are appended at the end of output. |
[in] | data | Address of data to encode. |
[in] | size | Size in bytes of data to encode. |
◆ encodeTerminate()
void ts::Base64::encodeTerminate |
( |
UString & |
b64 | ) |
|
Terminate binary data encoding, generate potential end of Base64 stream.
- Parameters
-
[in,out] | b64 | Output string. Produced characters are appended at the end of output. |
◆ decodeAdd()
Decode Base64 string and return partial binary data.
Some input Base64 characters may be internally kept, waiting for more characters to decode. Call decodeTerminate() to properly terminate and validate the decoding.
- Parameters
-
[in,out] | bin | Output binary data. Produced bytes are appended at the end of bin. |
[in] | b64 | Partial base64 string. |
- Returns
- True on success, false on invalid input Base64 format.
◆ decodeTerminate()
bool ts::Base64::decodeTerminate |
( |
ByteBlock & |
bin | ) |
|
Terminate Base64 decoding.
- Parameters
-
[in,out] | bin | Output binary data. Produced bytes are appended at the end of bin. |
- Returns
- True on success, false on invalid input Base64 format.
◆ Encode()
Bulk Base64 encoding.
- Parameters
-
[out] | b64 | Output Base64 string. |
[in] | data | Address of data to encode. |
[in] | size | Size in bytes of data to encode. |
[in] | line_size | Output text line size, when producing encoded Base64. When zero, do not generate new-line characters. |
◆ Encoded()
Bulk Base64 encoding.
- Parameters
-
[in] | data | Address of data to encode. |
[in] | size | Size in bytes of data to encode. |
[in] | line_size | Output text line size, when producing encoded Base64. When zero, do not generate new-line characters. |
- Returns
- Output Base64 string.
◆ Decode()
Bulk Base64 decoding.
- Parameters
-
[out] | bin | Output binary data. |
[in] | b64 | Full Base64 string. |
- Returns
- True on success, false on invalid input Base64 format.
◆ Decoded()
Bulk Base64 decoding.
- Parameters
-
- Returns
- Output binary data. In case of error, return the successfully decoded part. It is not possible to determine if the input Base64 string was full correct or only partially decoded.
The documentation for this class was generated from the following file: