base64::Encoder
Encoder
#include <icy/base64.h>Inherits:
Encoder
Base64 encoder.
Public Attributes
| Return | Name | Description |
|---|---|---|
internal::encodestate | _state | |
int | _buffersize |
_state
internal::encodestate _state_buffersize
int _buffersizePublic Methods
| Return | Name | Description |
|---|---|---|
Encoder inline | #### Parameters | |
void | encode inline | Encodes the entire input stream and writes Base64 output to ostrm. Resets the encoder state after completion. |
void | encode inline | Encodes a string to Base64 and appends the result to out. Resets the encoder state after completion. |
ssize_t | encode virtual inline | Encodes a raw buffer, writing Base64 characters to outbuf. May be called multiple times before calling [finalize()](#finalize-4). |
ssize_t | finalize virtual inline | Writes any pending padding and resets the encoder state. Must be called once after all [encode()](#encode-17) calls to flush the final block. |
void | setLineLength inline | Sets the line wrap length for encoded output (0 disables line wrapping). |
Encoder
inline
inline Encoder(int buffersize)Parameters
buffersizeInternal read buffer size in bytes.
encode
inline
inline void encode(std::istream & istrm, std::ostream & ostrm)Encodes the entire input stream and writes Base64 output to ostrm. Resets the encoder state after completion.
Parameters
istrmSource stream to encode.ostrmDestination stream for Base64 output.
encode
inline
inline void encode(const std::string & in, std::string & out)Encodes a string to Base64 and appends the result to out. Resets the encoder state after completion.
Parameters
inInput string.outOutput string to which Base64 characters are appended.
encode
virtual inline
virtual inline ssize_t encode(const char * inbuf, size_t nread, char * outbuf)Encodes a raw buffer, writing Base64 characters to outbuf. May be called multiple times before calling [finalize()](#finalize-4).
Parameters
inbufInput binary data.nreadNumber of bytes to encode.outbufOutput buffer; must be at leastnread * 4 / 3 + 4bytes.
Returns
Number of Base64 characters written.
finalize
virtual inline
virtual inline ssize_t finalize(char * outbuf)Writes any pending padding and resets the encoder state. Must be called once after all [encode()](#encode-17) calls to flush the final block.
Parameters
outbufOutput buffer; must be at least 5 bytes.
Returns
Number of characters written.
setLineLength
inline
inline void setLineLength(int lineLength)Sets the line wrap length for encoded output (0 disables line wrapping).
Parameters
lineLengthCharacters per line; use 0 to disable.
