![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Input stream that transparently decompresses gzip-compressed data. More...
Inheritance diagram for CDPL.Util.GZipIStream:Public Member Functions | |
| None | __init__ () |
Contructs the GZipIStream instance. | |
| None | __init__ (Base.IStream is) |
Constructs a GZipIStream instance that will read the compressed data from the input stream is. More... | |
| str | readline (int size=-1) |
| Reads one entire line. More... | |
| list | readlines (int size=-1) |
| Reads lines until EOF and returns a list containing the lines thus read. More... | |
| GZipIStream | xreadlines () |
| Returns the stream instance. More... | |
| str | read (int size=-1) |
| Reads at most size bytes. More... | |
| int | tell () |
| Returns the current read position. More... | |
| int | tellr () |
| Returns the current read position. More... | |
| None | seek (int offs, int whence=0) |
| Sets the current read position. More... | |
| None | seekr (int offs, int whence=0) |
| Sets the current read position. More... | |
| str | next () |
| Reads and returns the next line. 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... | |
| None | close () |
| Closes the stream. More... | |
| None | open (Base.IStream is) |
| Sets the input stream that provides the compressed data. More... | |
| GZipIStream | __iter__ () |
| Returns the stream instance. More... | |
Public Member Functions inherited from CDPL.Base.IStream | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
Properties | |
| closed = property(isClosed) | |
| mode = property(getOpenModeString) | |
| modeFlags = property(getOpenModeFlags) | |
Properties inherited from CDPL.Base.IStream | |
| objectID = property(getObjectID) | |
Additional Inherited Members | |
Static Public Attributes inherited from CDPL.Base.IStream | |
| STD_IN = _HIDDEN_VALUE_ | |
| The standard input stream of the current process. | |
Input stream that transparently decompresses gzip-compressed data.
| None CDPL.Util.GZipIStream.__init__ | ( | Base.IStream | is | ) |
Constructs a GZipIStream instance that will read the compressed data from the input stream is.
| is | The input stream to read from. |
| str CDPL.Util.GZipIStream.readline | ( | int | size = -1 | ) |
Reads one entire line.
A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). If the size argument is present and non-negative, it is a maximum byte count (including the trailing newline) and an incomplete line may be returned. When size is not 0, an empty string is returned only if EOF is encountered immediately.
| size | If present and non-negative, specifies the maximum number of bytes to read (including the trailing newline). |
| list CDPL.Util.GZipIStream.readlines | ( | int | size = -1 | ) |
Reads lines until EOF and returns a list containing the lines thus read.
If the optional size argument is present and non-negative, instead of reading up to EOF, whole lines totalling approximately size bytes are read.
| size | If present and non-negative, specifies the maximum number of bytes to read. |
| GZipIStream CDPL.Util.GZipIStream.xreadlines | ( | ) |
Returns the stream instance.
| str CDPL.Util.GZipIStream.read | ( | int | size = -1 | ) |
Reads at most size bytes.
If the size argument is negative or omitted, all data until EOF is reached are read. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediately.
| size | If present and non-negative, specifies the maximum number of bytes to read. |
| int CDPL.Util.GZipIStream.tell | ( | ) |
Returns the current read position.
| int CDPL.Util.GZipIStream.tellr | ( | ) |
Returns the current read position.
| None CDPL.Util.GZipIStream.seek | ( | int | offs, |
| int | whence = 0 |
||
| ) |
Sets the current read 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.
| offs | The offset to use for the seek operation. |
| whence | Value specifying how to calculate the final read position. |
| None CDPL.Util.GZipIStream.seekr | ( | int | offs, |
| int | whence = 0 |
||
| ) |
Sets the current read 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.
| offs | The offset to use for the seek operation. |
| whence | Value specifying how to calculate the final read position. |
| str CDPL.Util.GZipIStream.next | ( | ) |
Reads and returns the next line.
A stream object is its own iterator, for example iter(s) returns s. When a stream is used as an iterator, typically in a for loop (for example, for line in s: print line.strip()), the next() method is called repeatedly. This method returns the next input line, or raises StopIteration when EOF is hit when the stream is open for reading (when the stream has been opened for writing only then Base.IOError is raised).
| bool CDPL.Util.GZipIStream.isClosed | ( | ) |
Tells whether the stream has been closed.
| str CDPL.Util.GZipIStream.getOpenModeString | ( | ) |
Returns the open mode string that was provided as argument to the constructor.
| OpenMode CDPL.Util.GZipIStream.getOpenModeFlags | ( | ) |
Returns the open mode flags that were provided as argument to the constructor.
| None CDPL.Util.GZipIStream.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.
| None CDPL.Util.GZipIStream.open | ( | Base.IStream | is | ) |
Sets the input stream that provides the compressed data.
| is | The new input stream to read from. |
| GZipIStream CDPL.Util.GZipIStream.__iter__ | ( | ) |
Returns the stream instance.