1#ifndef BYTEME_GZIP_FILE_READER_HPP
2#define BYTEME_GZIP_FILE_READER_HPP
8#include "SelfClosingGzFile.hpp"
30 GzipFileReader(
const char* path,
size_t buffer_size = 65536) : my_gzfile(path,
"rb"), my_buffer(buffer_size) {}
40 my_read = gzread(my_gzfile.handle, my_buffer.data(), my_buffer.size());
45 if (!gzeof(my_gzfile.handle)) {
47 throw std::runtime_error(gzerror(my_gzfile.handle, &dummy));
53 const unsigned char*
buffer()
const {
54 return my_buffer.data();
62 SelfClosingGzFile my_gzfile;
63 std::vector<unsigned char> my_buffer;
Read uncompressed bytes from a Gzip-compressed file.
Definition GzipFileReader.hpp:24
size_t available() const
Definition GzipFileReader.hpp:57
const unsigned char * buffer() const
Definition GzipFileReader.hpp:53
GzipFileReader(const std::string &path, size_t buffer_size=65536)
Definition GzipFileReader.hpp:36
bool load()
Definition GzipFileReader.hpp:39
GzipFileReader(const char *path, size_t buffer_size=65536)
Definition GzipFileReader.hpp:30
Virtual class for reading bytes from a source.
Definition Reader.hpp:15
Simple byte readers and writers.