8 #ifndef BASE64_ENCODE_H 9 #define BASE64_ENCODE_H 28 : _buffersize(buffersize_in)
38 int encode(
const char* code_in,
const int length_in,
char* plaintext_out)
48 void encode(std::istream& istream_in, std::ostream& ostream_in)
52 const int N = _buffersize;
53 char* plaintext =
new char[N];
54 char* code =
new char[2*N];
60 istream_in.read(plaintext, N);
61 plainlength = istream_in.gcount();
63 codelength = encode(plaintext, plainlength, code);
64 ostream_in.write(code, codelength);
66 while (istream_in.good() && plainlength > 0);
68 codelength = encode_end(code);
69 ostream_in.write(code, codelength);
80 #endif // BASE64_ENCODE_H void base64_init_encodestate(base64_encodestate *state_in)
int encode_end(char *plaintext_out)
char base64_encode_value(char value_in)
base64_encodestate _state
encoder(int buffersize_in=512)
int encode(const char *code_in, const int length_in, char *plaintext_out)
int encode(char value_in)
void encode(std::istream &istream_in, std::ostream &ostream_in)
int base64_encode_block(const char *plaintext_in, int length_in, char *code_out, base64_encodestate *state_in)
int base64_encode_blockend(char *code_out, base64_encodestate *state_in)