9 #include <botan/data_src.h>
10 #include <botan/exceptn.h>
29 return peek(&out, 1, 0);
39 for(
size_t j = 0; j !=
n; ++j)
49 size_t got = std::min<size_t>(source.size() - offset, length);
59 size_t peek_offset)
const
61 const size_t bytes_left = source.size() - offset;
62 if(peek_offset >= bytes_left)
return 0;
64 size_t got = std::min(bytes_left - peek_offset, length);
65 copy_mem(out, &source[offset + peek_offset], got);
74 return (offset == source.size());
81 source(reinterpret_cast<const
byte*>(in.data()),
82 reinterpret_cast<const
byte*>(in.data()) + in.length()),
93 source.read(reinterpret_cast<char*>(out), length);
97 size_t got = source.gcount();
108 throw Invalid_State(
"DataSource_Stream: Cannot peek when out of data");
115 source.read(reinterpret_cast<char*>(&buf[0]), buf.size());
118 got = source.gcount();
123 source.read(reinterpret_cast<char*>(out), length);
126 got = source.gcount();
131 source.seekg(total_read, std::ios::beg);
141 return (!source.good());
158 source_p(new std::ifstream(
160 use_binary ? std::ios::binary : std::ios::in)),
175 const std::string& name) :