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