An SilkFile object represents a channel for writing to or
reading from SiLK flow files. A SiLK file open for reading can be
iterated over using for rec in file.
| filename, mode, compression=DEFAULT, notes=[], invocations=[] ) |
| Mode | Meaning |
|---|---|
| READ | Open file for reading |
| WRITE | Open file for writing |
| APPEND | Open file for appending |
The compression parameter can be one of the following constants:
| Constant | Meaning |
|---|---|
| DEFAULT | Default compression scheme compiled into SiLK |
| NO_COMPRESSION | No compression |
| ZLIB | Use zlib block compression |
| LZO1X | Use lzo1x block compression |
If notes or invocations are set, they should be list of strings. These add annotation and invocation headers to the file.
Examples:
>>> myinputfile = SilkFile('/path/to/file', READ)
>>> myoutputfile = SilkFile('/path/to/file', WRITE, compression=LZO1X,
notes=['My output file',
'another annotation'])
Instance methods:
| ) |
| rec) |
| ) |
iter(f) returns f. When the SilkFile is
used as an iterator, the next() method is called repeatedly.
This method returns the next record, or raises
StopIteration when EOF is hit.
| ) |
| ) |
| ) |