30inline void write(std::ostream& os, T value)
32 os.write((
char*) &value,
sizeof(T));
37inline T
read(std::istream& is)
40 is.read((
char*) &value,
sizeof(T));
46inline T
read(
const char *buf)
49 std::copy(buf, buf +
sizeof(T),
reinterpret_cast<char*
>(&value));
57 const char *ptr =
reinterpret_cast<const char*
>(&val);
58 vec.insert(vec.end(), ptr, ptr +
sizeof(T));
63void WriteBase64(std::ostream &
out,
const void *bytes,
size_t nbytes);
68void DecodeBase64(
const char *src,
size_t len, std::vector<char> &buf);
void write(std::ostream &os, T value)
Write 'value' to stream.
void WriteBase64(std::ostream &out, const void *bytes, size_t nbytes)
Given a buffer bytes of length nbytes, encode the data in base-64 format, and write the encoded data ...
void DecodeBase64(const char *src, size_t len, std::vector< char > &buf)
Decode len base-64 encoded characters in the buffer src, and store the resulting decoded data in buf....
size_t NumBase64Chars(size_t nbytes)
Return the number of characters needed to encode nbytes in base-64.
T read(std::istream &is)
Read a value from the stream and return it.
void AppendBytes(std::vector< char > &vec, const T &val)
Append the binary representation of val to the byte buffer vec.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...