21 #ifndef EMODNET_QMGC_GZIP_FILE_READER_H 22 #define EMODNET_QMGC_GZIP_FILE_READER_H 36 typedef unsigned char Byte;
82 int bytesRead = gzread(m_file, buffer, sz);
84 memcpy(&ret, &buffer[0], sz);
96 bool close() {
return gzclose(m_file); }
99 bool eof() {
return gzeof(m_file); }
107 #endif //EMODNET_QMGC_GZIP_FILE_READER_H Helper class to read a GZip file.
Definition: gzip_file_reader.h:32
unsigned short readUShort()
Reads an unsigned short.
Definition: gzip_file_reader.cpp:81
short readShort()
Reads a short.
Definition: gzip_file_reader.cpp:74
GZipFileReader(const std::string &filePath)
Constructor.
Definition: gzip_file_reader.cpp:23
void skipBytes(int numBytes)
Skips a given number of bytes.
Definition: gzip_file_reader.cpp:38
bool eof()
Indicates the end of file.
Definition: gzip_file_reader.h:99
bool isFileOpen()
Check if the file is open.
Definition: gzip_file_reader.h:42
int readInt()
Reads a int.
Definition: gzip_file_reader.cpp:60
unsigned int readUInt()
Reads an unsigned int.
Definition: gzip_file_reader.cpp:67
T read()
Generic templated read function.
Definition: gzip_file_reader.h:76
unsigned char readUChar()
Reads an unsigned char.
Definition: gzip_file_reader.cpp:95
bool close()
Closes the file.
Definition: gzip_file_reader.h:96
Byte readByte()
Reads a byte.
Definition: gzip_file_reader.cpp:31
int getPos()
Returns the position on the file (i.e., read byte counter)
Definition: gzip_file_reader.h:93
double readDouble()
Reads a double.
Definition: gzip_file_reader.cpp:46
char readChar()
Reads a char.
Definition: gzip_file_reader.cpp:88
float readFloat()
Reads a float.
Definition: gzip_file_reader.cpp:53