Module tarfile :: Class _Stream
[hide private]
[frames] | no frames]

_ClassType _Stream

Class that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method and is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin, sys.stdout, a socket, a tape device etc.

_Stream is intended to be used only internally.

Instance Methods [hide private]
 
__init__(self, name, mode, comptype, fileobj, bufsize)
Construct a _Stream object.
 
__del__(self)
 
_init_write_gz(self)
Initialize for writing with gzip compression.
 
write(self, s)
Write string s to the stream.
 
__write(self, s)
Write string s to the stream if a whole new block is ready to be written.
 
close(self)
Close the _Stream object.
 
_init_read_gz(self)
Initialize for reading a gzip compressed fileobj.
 
tell(self)
Return the stream's file pointer position.
 
seek(self, pos=0)
Set the stream's file pointer to pos.
 
read(self, size=None)
Return the next size number of bytes from the stream.
 
_read(self, size)
Return size bytes from the stream.
 
__read(self, size)
Return size bytes from stream.
 
_Stream__read(self, size)
Return size bytes from stream.
 
_Stream__write(self, s)
Write string s to the stream if a whole new block is ready to be written.
Method Details [hide private]

close(self)

 

Close the _Stream object. No operation should be done on it afterwards.

seek(self, pos=0)

 

Set the stream's file pointer to pos. Negative seeking is forbidden.

read(self, size=None)

 

Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF.

__read(self, size)

 

Return size bytes from stream. If internal buffer is empty, read another block from the stream.

_Stream__read(self, size)

 

Return size bytes from stream. If internal buffer is empty, read another block from the stream.