File stream input with gzip functionality.
#include <Mesh/FileIO/Compression/iautogzstream.h>
Inherits streambuf, and istream.
◆ iautogzstream() [1/3]
◆ iautogzstream() [2/3]
◆ iautogzstream() [3/3]
◆ ~iautogzstream()
◆ Close()
Close the currently open file. If one is not open, nothing is done.
- Warning
- It is the caller's responsibility to not use a closed stream!
◆ Flush()
◆ GetFileName()
const std::string & GetFileName |
( |
| ) |
const |
|
inline |
- Returns
- The name of the file currently open or the name that was used to attempt an open. Clients should use IsReady() to test if a file is open and ready for reading.
◆ IsReady()
- Returns
- TRUE if the file is ready for input.
◆ Open() [1/2]
bool Open |
( |
std::string |
fName | ) |
|
This form of Open() automatically detects whether on-the-fly gzip compression is required by checking for a
.gz extension on the file name.
- Returns
- True if the file was able to be opened.
◆ Open() [2/2]
bool Open |
( |
std::string |
fName, |
|
|
bool |
useCompression |
|
) |
| |
- Parameters
-
fName | Name of file to open. |
useCompression | If TRUE, on-the-fly gzip compression will be used. Otherwise the file is opened as plain text. |
Opens a file for input with the specified gzip behaviour. If useCompression==TRUE
and fName does not end in
.gz, it will be appended to the file name automatically. If a file is already open, it will be closed and the new name opened in its place.
You should check the success of this operation with the IsReady() function.
- Returns
- True if the file was able to be opened.
◆ Rewind()
Rewind the file so that input is taken from the beginning again. You should check the result with the good() function, as usual.
◆ Seek() [1/2]
bool Seek |
( |
std::ios::off_type |
offset, |
|
|
std::ios_base::seekdir |
dir |
|
) |
| |
Set the current read position to offset relative to the position dir. Be warned that if compression is being used on the input file, this function could be very slow.
- Returns
- True if the seek was able to be performed.
◆ Seek() [2/2]
bool Seek |
( |
std::ios::pos_type |
pos | ) |
|
Set the current read position to pos (an absolute position). Be warned that if compression is being used on the input file, this function could be very slow.
- Returns
- True if the seek was able to be performed.
◆ Tell()
std::ios::pos_type Tell |
( |
| ) |
|
- Returns
- The current read position in the file. If there is an error, it will return pos_type(off_type(-1)).
◆ UsingCompression()
bool UsingCompression |
( |
| ) |
const |
|
inline |
Public member function so that user can enquire if compression is being used. Hiding the usingCompression data member stops an ignorant user from wrongly trying to switch the file type.
◆ fileName