22#include <arrow/io/interfaces.h>
23#include <avro/Stream.hh>
25namespace iceberg::avro {
29 explicit AvroInputStream(std::shared_ptr<::arrow::io::RandomAccessFile> input_stream,
37 bool next(
const uint8_t** data,
size_t* len)
override;
41 void backup(
size_t len)
override;
44 void skip(
size_t len)
override;
54 void seek(int64_t position)
override;
57 std::shared_ptr<::arrow::io::RandomAccessFile> input_stream_;
58 const int64_t buffer_size_;
59 std::vector<uint8_t> buffer_;
60 size_t byte_count_ = 0;
61 size_t buffer_pos_ = 0;
62 size_t available_bytes_ = 0;
67 explicit AvroOutputStream(std::shared_ptr<::arrow::io::OutputStream> output_stream,
75 bool next(uint8_t** data,
size_t* len)
override;
79 void backup(
size_t len)
override;
88 void flush()
override;
90 const std::shared_ptr<::arrow::io::OutputStream>& arrow_output_stream()
const;
93 std::shared_ptr<::arrow::io::OutputStream> output_stream_;
94 const int64_t buffer_size_;
95 std::vector<uint8_t> buffer_;
96 size_t buffer_pos_ = 0;
97 uint64_t flushed_bytes_ = 0;
Definition avro_stream_internal.h:65
uint64_t byteCount() const override
Number of bytes written so far into this stream. The whole buffer returned by next() is assumed to be...
Definition avro_stream_internal.cc:127
bool next(uint8_t **data, size_t *len) override
Returns a buffer that can be written into. On successful return, data has the pointer to the buffer a...
Definition avro_stream_internal.cc:108
void backup(size_t len) override
"Returns" back to the stream some of the buffer obtained from in the last call to next().
Definition avro_stream_internal.cc:120
void flush() override
Flushes any data remaining in the buffer to the stream's underlying store, if any.
Definition avro_stream_internal.cc:129