MRPT logo

mrpt::utils::CFileGZInputStream Class Reference

Transparently opens a compressed "gz" file and reads uncompressed data from it. More...

#include <mrpt/utils/CFileGZInputStream.h>

Inheritance diagram for mrpt::utils::CFileGZInputStream:

mrpt::utils::CStream mrpt::utils::CUncopiable

List of all members.

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.
size_t getTotalBytesCount ()
 Method for getting the total number of compressed bytes in the file.
size_t getPosition ()
 Method for getting the current cursor position in the compressed, where 0 is the first byte and TotalBytesCount-1 the last one.
size_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
size_t m_file_size
 Compressed file size.


Detailed Description

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

See also:
CFileInputStream

Definition at line 49 of file CFileGZInputStream.h.


Constructor & Destructor Documentation

mrpt::utils::CFileGZInputStream::CFileGZInputStream (  ) 

Constructor without open.

mrpt::utils::CFileGZInputStream::CFileGZInputStream ( const std::string &  fileName  ) 

Constructor and open.

Parameters:
fileName The file to be open in this stream
Exceptions:
std::exception If there's an error opening the file.

virtual mrpt::utils::CFileGZInputStream::~CFileGZInputStream (  )  [virtual]

Destructor.


Member Function Documentation

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.

size_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.

size_t mrpt::utils::CFileGZInputStream::getTotalBytesCount (  )  [virtual]

Method for getting the total number of compressed bytes in the file.

Implements mrpt::utils::CStream.

bool mrpt::utils::CFileGZInputStream::open ( const std::string &  fileName  ) 

Opens the file for read.

Parameters:
fileName The file to be open in this stream
Returns:
false if there's an error opening the file, true otherwise

size_t mrpt::utils::CFileGZInputStream::Read ( void *  Buffer,
size_t  Count 
) [protected, virtual]

Method responsible for reading from the stream.

Implements mrpt::utils::CStream.

size_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 108 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.


Member Data Documentation

Definition at line 64 of file CFileGZInputStream.h.

Compressed file size.

Definition at line 65 of file CFileGZInputStream.h.




Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Sun Aug 9 21:47:23 CEST 2009