Transparently opens a compressed "gz" file and reads uncompressed data from it.
If the file is not a .gz file, it silently reads data from the file. This class requires compiling MRPT with wxWidgets. If wxWidgets is not available then the class is actually mapped to the standard CFileInputStream
#include <mrpt/utils/CFileGZInputStream.h>

Public Member Functions | |
| CFileGZInputStream () | |
| Constructor without open. | |
| CFileGZInputStream (const std::string &fileName) | |
| Constructor and open. | |
| virtual | ~CFileGZInputStream () |
| Destructor. | |
| bool | open (const std::string &fileName) |
| Opens the file for read. | |
| void | close () |
| Closes the file. | |
| bool | fileOpenCorrectly () |
| Says if file was open successfully or not. | |
| bool | checkEOF () |
| Will be true if EOF has been already reached. | |
| uint64_t | getTotalBytesCount () |
| Method for getting the total number of compressed bytes of in the file (the physical size of the compressed file). | |
| uint64_t | getPosition () |
| Method for getting the current cursor position in the compressed, where 0 is the first byte and TotalBytesCount-1 the last one. | |
| uint64_t | Seek (long Offset, CStream::TSeekOrigin Origin=sFromBeginning) |
| This method is not implemented in this class. | |
Protected Member Functions | |
| size_t | Read (void *Buffer, size_t Count) |
| Method responsible for reading from the stream. | |
| size_t | Write (const void *Buffer, size_t Count) |
| Method responsible for writing to the stream. | |
Private Attributes | |
| void * | m_f |
| uint64_t | m_file_size |
| Compressed file size. | |
| mrpt::utils::CFileGZInputStream::CFileGZInputStream | ( | ) |
Constructor without open.
| mrpt::utils::CFileGZInputStream::CFileGZInputStream | ( | const std::string & | fileName | ) |
Constructor and open.
| fileName | The file to be open in this stream |
| std::exception | If there's an error opening the file. |
| virtual mrpt::utils::CFileGZInputStream::~CFileGZInputStream | ( | ) | [virtual] |
Destructor.
| bool mrpt::utils::CFileGZInputStream::checkEOF | ( | ) |
Will be true if EOF has been already reached.
| void mrpt::utils::CFileGZInputStream::close | ( | ) |
Closes the file.
| bool mrpt::utils::CFileGZInputStream::fileOpenCorrectly | ( | ) |
Says if file was open successfully or not.
| uint64_t mrpt::utils::CFileGZInputStream::getPosition | ( | ) | [virtual] |
Method for getting the current cursor position in the compressed, where 0 is the first byte and TotalBytesCount-1 the last one.
Implements mrpt::utils::CStream.
| uint64_t mrpt::utils::CFileGZInputStream::getTotalBytesCount | ( | ) | [virtual] |
Method for getting the total number of compressed bytes of in the file (the physical size of the compressed file).
Implements mrpt::utils::CStream.
| bool mrpt::utils::CFileGZInputStream::open | ( | const std::string & | fileName | ) |
Opens the file for read.
| fileName | The file to be open in this stream |
| size_t mrpt::utils::CFileGZInputStream::Read | ( | void * | Buffer, |
| size_t | Count | ||
| ) | [protected, virtual] |
Method responsible for reading from the stream.
Implements mrpt::utils::CStream.
| uint64_t mrpt::utils::CFileGZInputStream::Seek | ( | long | Offset, |
| CStream::TSeekOrigin | Origin = sFromBeginning |
||
| ) | [inline, virtual] |
This method is not implemented in this class.
Implements mrpt::utils::CStream.
Definition at line 109 of file CFileGZInputStream.h.
References THROW_EXCEPTION.
| size_t mrpt::utils::CFileGZInputStream::Write | ( | const void * | Buffer, |
| size_t | Count | ||
| ) | [protected, virtual] |
Method responsible for writing to the stream.
Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written.
Implements mrpt::utils::CStream.
void* mrpt::utils::CFileGZInputStream::m_f [private] |
Definition at line 65 of file CFileGZInputStream.h.
uint64_t mrpt::utils::CFileGZInputStream::m_file_size [private] |
Compressed file size.
Definition at line 66 of file CFileGZInputStream.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011 |