Stream with on-the-fly decompression. More...
#include <cmtkCompressedStream.h>
Classes | |
struct | ArchiveLookupEntry |
Entry for the suffix-to-archiver assignment table. More... | |
class | File |
Class for uncompressed file-based reader engine. More... | |
class | Pipe |
Class for reader engine using pipe. More... | |
class | ReaderBase |
Abstract base class for low-level reader engines. More... | |
class | Zlib |
Class for Zlib-based reader engine. More... | |
Public Types | |
typedef CompressedStream | Self |
This class. | |
Public Member Functions | |
CompressedStream () | |
Create stream object without opening any files. | |
CompressedStream (const char *filename) | |
Create stream from filename. | |
~CompressedStream () | |
Dispose stream object. | |
bool | IsValid () const |
Return validity of stream. | |
bool | IsCompressed () const |
Return flag whether this stream is actually using decompression or simply reads a file as-is. | |
bool | Open (const char *filename) |
Open new stream from filename. | |
void | Close () |
Close current file stream. | |
void | Rewind () |
Set filepointer to beginning of file. | |
int | Seek (const long int offset, int whence) |
Set filepointer. | |
size_t | Read (void *data, size_t size, size_t count) |
Read block of data. | |
int | Get (char &c) |
Read a single character from the stream. | |
int | Tell () const |
Return number of bytes read from stream. | |
bool | Feof () const |
Return 1 if and only if end of file reached. | |
Static Public Member Functions | |
static std::string | GetBaseName (const std::string &path) |
Return base name of a path without compression suffix. | |
static int | Stat (const char *path, struct stat *const buf=NULL) |
Do stat() on compressed file. | |
Private Member Functions | |
bool | OpenDecompressionPipe (const char *filename, const char *suffix, const char *command, const char *compressedSuffix) |
Open decompressing pipe. | |
Private Attributes | |
ReaderBase::SmartPtr | m_Reader |
The low-level reader object. | |
bool | m_Compressed |
Flag whether current stream is from a compressed source. | |
Static Private Attributes | |
static const ArchiveLookupEntry | ArchiveLookup [] |
The suffix-to-archiver assignment table. |
Stream with on-the-fly decompression.
Definition at line 77 of file cmtkCompressedStream.h.
This class.
Definition at line 83 of file cmtkCompressedStream.h.
cmtk::CompressedStream::CompressedStream | ( | ) | [inline] |
Create stream object without opening any files.
Definition at line 86 of file cmtkCompressedStream.h.
bool cmtk::CompressedStream::Feof | ( | ) | const [inline] |
Return 1 if and only if end of file reached.
Definition at line 151 of file cmtkCompressedStream.h.
Referenced by cmtk::VolumeFromFile::ReadBioRad().
int cmtk::CompressedStream::Get | ( | char & | c ) | [inline] |
Read a single character from the stream.
Definition at line 139 of file cmtkCompressedStream.h.
Referenced by cmtk::PGM::Read().
bool cmtk::CompressedStream::IsCompressed | ( | ) | const [inline] |
Return flag whether this stream is actually using decompression or simply reads a file as-is.
Definition at line 101 of file cmtkCompressedStream.h.
Referenced by cmtk::FileFormat::IdentifyFile().
bool cmtk::CompressedStream::IsValid | ( | ) | const [inline] |
Return validity of stream.
Definition at line 95 of file cmtkCompressedStream.h.
References NULL.
Referenced by cmtk::FileFormat::IdentifyFile(), Open(), cmtk::PGM::Read(), cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().
size_t cmtk::CompressedStream::Read | ( | void * | data, |
size_t | size, | ||
size_t | count | ||
) | [inline] |
Read block of data.
Definition at line 133 of file cmtkCompressedStream.h.
Referenced by cmtk::FileFormat::IdentifyFile(), cmtk::PGM::Read(), cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), cmtk::VolumeFromFile::ReadBioRad(), cmtk::VolumeFromFile::ReadNifti(), and cmtk::VolumeFromFile::ReadVanderbilt().
void cmtk::CompressedStream::Rewind | ( | ) | [inline] |
Set filepointer to beginning of file.
Definition at line 114 of file cmtkCompressedStream.h.
int cmtk::CompressedStream::Seek | ( | const long int | offset, |
int | whence | ||
) | [inline] |
Set filepointer.
If the object represents a pipe with on-the-fly decompression, only the set mode "SEEK_CUR" is supported and will be simulated by successive reading of 8kB data blocks from the pipe.
offset | Offset the file pointer is set to, depending on the value of whence. |
whence | File pointer set mode as defined for fseek. |
Definition at line 127 of file cmtkCompressedStream.h.
Referenced by cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().
int cmtk::CompressedStream::Tell | ( | ) | const [inline] |
Return number of bytes read from stream.
Definition at line 145 of file cmtkCompressedStream.h.
bool cmtk::CompressedStream::m_Compressed [private] |
Flag whether current stream is from a compressed source.
Definition at line 478 of file cmtkCompressedStream.h.
Referenced by Open().
The low-level reader object.
Definition at line 475 of file cmtkCompressedStream.h.