File stream output with gzip functionality.
#include <Mesh/FileIO/Compression/oautogzstream.h>
Inherits ostream.
|
| oautogzstream () |
| Constructs a stream not connected to anything.
|
|
| oautogzstream (std::ostream &os) |
|
| oautogzstream (std::string fName) |
| Construct a stream by opening the file named fName.
|
|
| oautogzstream (std::string fName, bool useCompression) |
|
| ~oautogzstream () override |
|
void | Close () |
| Close the currently open file. If one is not open, nothing is done.
|
|
void | Flush () |
| Flush the currently open file. If one is not open, nothing is done.
|
|
const std::string & | GetFileName () const |
|
bool | IsReady () const |
|
void | Open (std::string fName) |
|
void | Open (std::string fName, bool useCompression) |
|
bool | UsingCompression () |
|
◆ oautogzstream() [1/4]
◆ oautogzstream() [2/4]
Constructs a stream that writes to the same stream buffer as os. Writing to the constructed stream is then just like writing to os.
◆ oautogzstream() [3/4]
◆ oautogzstream() [4/4]
Construct a stream by opening the file named fName, and if useCompression is true, then use compression on the output file on-the-fly.
◆ ~oautogzstream()
◆ Close()
◆ Flush()
◆ GetFileName()
const std::string & GetFileName |
( |
| ) |
const |
|
inline |
◆ IsReady()
- Returns
- TRUE if the file is ready for output.
◆ Open() [1/2]
void 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.
◆ Open() [2/2]
void 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 output with the specified gzip behaviour. If useCompression==TRUE
and fName does not end in
.gz, it will be appended to the file name automatically.
You should check the success of this operation with the IsReady() function.
◆ UsingCompression()
bool UsingCompression |
( |
| ) |
|
|
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