Chemical Data Processing Library Python API - Version 1.4.0
Public Member Functions | Properties | List of all members
CDPL.Util.GZipOStream Class Reference

Output stream that transparently writes gzip-compressed data. More...

+ Inheritance diagram for CDPL.Util.GZipOStream:

Public Member Functions

None __init__ ()
 Contructs the GZipOStream instance.
 
None __init__ (Base.OStream os)
 Constructs a GZipOStream instance that will write compressed data to the output stream os. More...
 
None flush ()
 Flushes the internal buffer.
 
None write (object string)
 Outputs the specified string. More...
 
None writelines (object iterable)
 Outputs the specified sequence of strings. More...
 
int tellw ()
 Returns the current write position. More...
 
None seekw (int offs, int whence=0)
 Sets the current write position. More...
 
bool isClosed ()
 Tells whether the stream has been closed. More...
 
str getOpenModeString ()
 Returns the open mode string that was provided as argument to the constructor. More...
 
OpenMode getOpenModeFlags ()
 Returns the open mode flags that were provided as argument to the constructor. More...
 
bool getSoftSpace ()
 Returns a boolean that indicates whether a space character needs to be printed before another value when using the print statement. More...
 
None setSoftSpace (bool value)
 Sets a boolean that indicates whether a space character needs to be printed before another value when using the print statement. More...
 
None close ()
 Closes the stream. More...
 
None open (Base.OStream os)
 Sets the output stream that receives the compressed data. More...
 
- Public Member Functions inherited from CDPL.Base.OStream
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 

Properties

 closed = property(isClosed)
 
 softspace = property(getSoftSpace, setSoftSpace)
 
 mode = property(getOpenModeString)
 
 modeFlags = property(getOpenModeFlags)
 
- Properties inherited from CDPL.Base.OStream
 objectID = property(getObjectID)
 

Additional Inherited Members

- Static Public Attributes inherited from CDPL.Base.OStream
 STD_OUT = _HIDDEN_VALUE_
 The standard output stream of the current process.
 
 STD_ERR = _HIDDEN_VALUE_
 The standard error stream of the current process.
 

Detailed Description

Output stream that transparently writes gzip-compressed data.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Util.GZipOStream.__init__ ( Base.OStream  os)

Constructs a GZipOStream instance that will write compressed data to the output stream os.

Parameters
osThe output stream to write to.

Member Function Documentation

◆ write()

None CDPL.Util.GZipOStream.write ( object  string)

Outputs the specified string.

Parameters
stringThe string to output.
Note
Due to buffering, the string may not actually show up in the file until the flush() or close() method is called.

◆ writelines()

None CDPL.Util.GZipOStream.writelines ( object  iterable)

Outputs the specified sequence of strings.

Parameters
iterableThe string sequence to output (can be any iterable object producing strings, typically a list of strings).

◆ tellw()

int CDPL.Util.GZipOStream.tellw ( )

Returns the current write position.

Returns
The current write position.

◆ seekw()

None CDPL.Util.GZipOStream.seekw ( int  offs,
int   whence = 0 
)

Sets the current write position.

The whence argument is optional and defaults to 0 (absolute positioning). Other supported values are 1 to seek relative to the current position and 2 for seeking relative to the end of input.

Parameters
offsThe offset to use for the seek operation.
whenceValue specifying how to calculate the final write position.

◆ isClosed()

bool CDPL.Util.GZipOStream.isClosed ( )

Tells whether the stream has been closed.

See also
close()

◆ getOpenModeString()

str CDPL.Util.GZipOStream.getOpenModeString ( )

Returns the open mode string that was provided as argument to the constructor.

Returns
The open mode string (e.g. 'r+') that was provided as argument to the constructor.

◆ getOpenModeFlags()

OpenMode CDPL.Util.GZipOStream.getOpenModeFlags ( )

Returns the open mode flags that were provided as argument to the constructor.

Returns
The open mode flags that were provided as argument to the constructor (see Stream.OpenMode).

◆ getSoftSpace()

bool CDPL.Util.GZipOStream.getSoftSpace ( )

Returns a boolean that indicates whether a space character needs to be printed before another value when using the print statement.

Returns
True if a space character needs to be printed before another value when using the print statement, and False otherwise.

◆ setSoftSpace()

None CDPL.Util.GZipOStream.setSoftSpace ( bool  value)

Sets a boolean that indicates whether a space character needs to be printed before another value when using the print statement.

Parameters
valueTrue if a space character shall be printed before another value when using the print statement, and False otherwise.

◆ close()

None CDPL.Util.GZipOStream.close ( )

Closes the stream.

A closed stream cannot be read from or written to anymore. Any operation which requires the stream to be open will raise a Base.ValueError after the stream has been closed. Calling close() more than once is allowed.

◆ open()

None CDPL.Util.GZipOStream.open ( Base.OStream  os)

Sets the output stream that receives the compressed data.

Parameters
osThe new output stream to write to.