#include <cypher.h>
Inheritance diagram for PBase64:
Public Member Functions | |
PBase64 () | |
void | StartEncoding (PBoolean useCRLFs=PTrue) |
void | ProcessEncoding (const PString &str) |
void | ProcessEncoding (const char *cstr) |
void | ProcessEncoding (const PBYTEArray &data) |
void | ProcessEncoding (const void *dataBlock, PINDEX length) |
PString | GetEncodedString () |
PString | CompleteEncoding () |
void | StartDecoding () |
PBoolean | ProcessDecoding (const PString &str) |
PBoolean | ProcessDecoding (const char *cstr) |
PBoolean | GetDecodedData (void *dataBlock, PINDEX length) |
PBYTEArray | GetDecodedData () |
PBoolean | IsDecodeOK () |
Static Public Member Functions | |
static PString | Encode (const PString &str) |
static PString | Encode (const char *cstr) |
static PString | Encode (const PBYTEArray &data) |
static PString | Encode (const void *dataBlock, PINDEX length) |
static PString | Decode (const PString &str) |
static PBoolean | Decode (const PString &str, PBYTEArray &data) |
static PBoolean | Decode (const PString &str, void *dataBlock, PINDEX length) |
To encode a large block of data use the following seqeunce: {verbatim} PBase64 base; base.StartEncoding(); while (Read(dataChunk)) { base.ProcessEncoding(dataChunk); out << base.GetEncodedString(); } out << base.CompleteEncoding(); {verbatim}
if smaller blocks that fit easily in memory are to be encoded the Encode()# functions can be used to everything in one go.
To decode a large block of data use the following sequence: {verbatim}
PBase64 base; base.StartDecoding(); while (Read(str) && ProcessDecoding(str)) Write(base.GetDecodedData()); Write(base.GetDecodedData()); {verbatim}
if smaller blocks that fit easily in memory are to be decoded the Decode()# functions can be used to everything in one go.
PBase64::PBase64 | ( | ) |
Construct a base 64 encoder/decoder and initialise both encode and decode members as in StartEncoding()# and StartDecoding()#.
void PBase64::StartEncoding | ( | PBoolean | useCRLFs = PTrue |
) |
void PBase64::ProcessEncoding | ( | const PString & | str | ) |
void PBase64::ProcessEncoding | ( | const char * | cstr | ) |
void PBase64::ProcessEncoding | ( | const PBYTEArray & | data | ) |
void PBase64::ProcessEncoding | ( | const void * | dataBlock, | |
PINDEX | length | |||
) |
PString PBase64::GetEncodedString | ( | ) |
Get the partial Base64 string for the data encoded so far.
PString PBase64::CompleteEncoding | ( | ) |
Complete the base 64 encoding and return the remainder of the encoded Base64 string. Previous data may have been already removed by the GetInterim()# function.
static PString PBase64::Encode | ( | const char * | cstr | ) | [static] |
static PString PBase64::Encode | ( | const PBYTEArray & | data | ) | [static] |
static PString PBase64::Encode | ( | const void * | dataBlock, | |
PINDEX | length | |||
) | [static] |
void PBase64::StartDecoding | ( | ) |
Incorporate the specified data into the base 64 decoding.
PBoolean PBase64::ProcessDecoding | ( | const char * | cstr | ) |
PBoolean PBase64::GetDecodedData | ( | void * | dataBlock, | |
PINDEX | length | |||
) |
Get the data decoded so far from the Base64 strings processed.
PBYTEArray PBase64::GetDecodedData | ( | ) |
PBoolean PBase64::IsDecodeOK | ( | ) | [inline] |
Return a flag to indicate that the input was decoded without any extraneous or illegal characters in it that were ignored. This does not mean that the data is not valid, only that it is suspect.
Convert a printable text string to binary data using the Internet MIME standard base 64 content transfer encoding.
The base64 string is checked and PTrue returned if all perfectly correct. If PFalse is returned then the string had extraneous or illegal characters in it that were ignored. This does not mean that the data is not valid, only that it is suspect.
static PBoolean PBase64::Decode | ( | const PString & | str, | |
PBYTEArray & | data | |||
) | [static] |