1 | #include "duckdb/common/serializer/buffered_deserializer.hpp" |
---|---|
2 | |
3 | #include <cstring> |
4 | |
5 | using namespace duckdb; |
6 | using namespace std; |
7 | |
8 | BufferedDeserializer::BufferedDeserializer(data_ptr_t ptr, idx_t data_size) : ptr(ptr), endptr(ptr + data_size) { |
9 | } |
10 | |
11 | BufferedDeserializer::BufferedDeserializer(BufferedSerializer &serializer) |
12 | : BufferedDeserializer(serializer.data, serializer.maximum_size) { |
13 | } |
14 | |
15 | void BufferedDeserializer::ReadData(data_ptr_t buffer, idx_t read_size) { |
16 | if (ptr + read_size > endptr) { |
17 | throw SerializationException("Failed to deserialize: not enough data in buffer to fulfill read request"); |
18 | } |
19 | memcpy(buffer, ptr, read_size); |
20 | ptr += read_size; |
21 | } |
22 |