| |
- __builtin__.file(__builtin__.object)
-
- BZ2File
- __builtin__.object
-
- BZ2Compressor
- BZ2Decompressor
class BZ2Compressor(__builtin__.object) |
|
BZ2Compressor([level=9]) -> compressor object
Creates a new compressor object. This object may be used to compress
data sequentially. If you want to compress data in one shot, use the
compress() function instead. The level parameter, if given, must be
a number between 1 and 9, providing the compress level. |
|
Methods defined here:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- compress(...)
- compress(str) -> string
Call this method to provide more data to the compressor object. It
will return chunks of compressed data whenever possible. When you've
finished providing data to compress, call the flush() method to finish
the compression process, returning what is left in internal buffers.
- flush(...)
- flush() -> string
This method finishes the compression process, returning what is
left in internal buffers. You must not use the compressor object
after calling this method.
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from __builtin__.object:
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __repr__(...)
- x.__repr__() <==> repr(x)
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from __builtin__.object:
- __class__ = <type 'type'>
- the object's class
|
class BZ2File(__builtin__.file) |
|
BZ2File(name [, mode='r', buffering=0, compresslevel=9]) -> file object
Open a bz2 file. The mode can be 'r' or 'w', for reading (default) or
writing. When opened for writing, the file will be created if it doesn't
exist, and truncated otherwise. If the buffering argument is given, 0 means
unbuffered, and larger numbers specify the buffer size. If compresslevel
is given, must be a number between 1 and 9. |
|
- Method resolution order:
- BZ2File
- __builtin__.file
- __builtin__.object
Methods defined here:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- close(...)
- close() -> None or (perhaps) an integer
Close the file. Sets data attribute .closed to true. A closed file
cannot be used for further I/O operations. close() may be called more
than once without error.
- read(...)
- read([size]) -> string
Read at most size uncompressed bytes, returned as a string. If the size
argument is negative or omitted, read until EOF is reached.
- readinto(...)
- Operation not supported.
- readline(...)
- readline([size]) -> string
Returns next line from the file, as a string, retaining newline.
A non-negative size argument limits the maximum number of bytes to
return (an incomplete line may be returned then). Return an empty
string at EOF.
- readlines(...)
- readlines([size]) -> list
Call readline() repeatedly and return a list of the lines so read.
The optional size argument, if given, is an approximate bound on the
total number of bytes in the lines returned.
- seek(...)
- seek(offset [, whence]) -> None
Move to new file position. Argument offset is a byte count. Optional
argument whence defaults to 0 (offset from start of file, offset
should be >= 0); other values are 1 (move relative to current position,
positive or negative), and 2 (move relative to end of file, usually
negative, although many platforms allow seeking beyond the end of a file).
Note that seeking of bz2 files is emulated, and depending on the parameters
the operation may be extremely slow.
- tell(...)
- tell() -> int
Returns current file position, an integer (may be a long integer).
- truncate(...)
- Operation not supported.
- write(...)
- write(str) -> None
Write string str to file. Note that due to buffering, close() may be
needed before the file on disk reflects the data written.
- writelines(...)
- writelines(sequence_of_strings) -> None
Write the strings to the file. Note that newlines are not added. The
sequence can be any iterable object producing strings. This is
equivalent to calling write() for each string.
Data and non-method functions defined here:
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from __builtin__.file:
- __iter__(...)
- x.__iter__() <==> iter(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- fileno(...)
- fileno() -> integer "file descriptor".
This is needed for lower-level file interfaces, such os.read().
- flush(...)
- flush() -> None. Flush the internal I/O buffer.
- isatty(...)
- isatty() -> true or false. True if the file is connected to a tty device.
- xreadlines(...)
- xreadlines() -> next line from the file, as a string.
Equivalent to xreadlines.xreadlines(file). This is like readline(), but
often quicker, due to reading ahead internally.
Data and non-method functions inherited from __builtin__.file:
- closed = <attribute 'closed' of 'file' objects>
- flag set if the file is closed
- mode = <member 'mode' of 'file' objects>
- file mode ('r', 'w', 'a', possibly with 'b' or '+' added)
- name = <member 'name' of 'file' objects>
- file name
- softspace = <member 'softspace' of 'file' objects>
- flag indicating that a space needs to be printed; used by print
Methods inherited from __builtin__.object:
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from __builtin__.object:
- __class__ = <type 'type'>
- the object's class
| |