27 : std::ostream(this), _mode(mode), _stream(stream), data_buf_(buffer), data_size_(buffer)
29 setp(&data_buf_[0], &data_buf_[0] + data_size_ - 1);
41 std::ios::pos_type pos = stream.tellg();
43 stream.read((
char*)&buf, 4096);
44 size_t bytes = stream.gcount();
50 if (stream.eof() && (bytes > 0)) stream.clear();
52 stream.seekp(pos, std::ios::beg);
53 stream.write((
char*)&buf, bytes);
65 std::ios::pos_type pos = stream.tellg();
67 stream.read((
char*)&buf, 4096);
68 size_t bytes = stream.gcount();
74 if (stream.eof() && (bytes > 0)) stream.clear();
76 stream.seekp(pos, std::ios::beg);
77 stream.write((
char*)&buf, bytes);
86 int ret = std::char_traits<char>::eq_int_type(this->
overflow(
87 std::char_traits<char>::eof()), std::char_traits<char>::eof()) ? -1
107 char *ibegin = &data_buf_[0];
111 setp(&data_buf_[0], &data_buf_[0] + data_size_ - 1);
113 if (!std::char_traits<char>::eq_int_type(c, std::char_traits<char>::eof()))
115 *iend++ = std::char_traits<char>::to_char_type(c);
119 if ((iend - ibegin) == 0)
121 return std::char_traits<char>::not_eof(c);
128 encrypt(&data_buf_[0], (iend - ibegin));
132 decrypt(&data_buf_[0], (iend - ibegin));
137 _stream.write(&data_buf_[0], (iend - ibegin));
139 return std::char_traits<char>::not_eof(c);