17 #ifndef ARCHIVE_POSIXFILEARCHIVE_H_
18 #define ARCHIVE_POSIXFILEARCHIVE_H_
34 if (!this->plain_text) {
35 auto const ext = boost::filesystem::path(
url_part(5)).extension();
36 this->plain_text = ext ==
".csv" || ext ==
".tsv" || ext ==
".txt" || ext ==
"";
39 if (this->plain_text) {
58 if (
nullptr == (
fp =
fopen(file_path.c_str(),
"r"))) {
59 throw std::runtime_error(std::string(
"fopen(") + file_path +
60 "): " + strerror(errno));
63 if (ARCHIVE_OK != archive_read_open_filename(
ar, file_path.c_str(), 1 << 16)) {
64 throw std::runtime_error(std::string(
"fopen(") + file_path +
65 "): " + strerror(errno));
virtual bool read_data_block(const void **buff, size_t *size, int64_t *offset)
~PosixFileArchive() override
PosixFileArchive(const std::string url, const bool plain_text)
bool read_next_header() override
::FILE * fopen(const char *filename, const char *mode)
bool read_data_block(const void **buff, size_t *size, int64_t *offset) override
size_t g_archive_read_buf_size
virtual int64_t get_position_compressed() const
const std::string url_part(const int i)
void init_for_read() override
virtual bool read_next_header()