Module gzipstream :: Class _StreamBuf
[hide private]
[frames] | no frames]

Class _StreamBuf

source code

Stream buffer for file-like objects.

Allow seeks on socket-like objects. Enables non-seekable file-like objects some flexibility as regards to seeking. It does this via a buffer, a StringIO object. Note, because it is assumed that a socket stream is being manipulated, once the buffer "window" has passed over a data segment, seeking prior to that is not allowed. XXX: probably reinventing the wheel.

Instance Methods [hide private]
 
__init__(self, stream=None, mode=None)
Constructor.
source code
 
__del__(self)
Destructor
source code
 
isatty(self) source code
 
_read(self, size)
A buffered read --- refactored.
source code
 
read(self, size=None)
A buffered read.
source code
 
readline(self)
Return one line of text: a string ending in a ' ' or EOF.
source code
 
readlines(self)
Read entire file into memory! And return a list of lines of text.
source code
 
_refactorBufIO(self, writeFlushYN=0)
Keep the buffer window within __{MAX,ABS_MAX}_BUF_SIZE before the current self._bufIO.tell() position.
source code
 
_dumpValues(self)
Debug code.
source code
 
write(self, s)
Write string to stream.
source code
 
writelines(self, l)
Given list, concatenate and write.
source code
 
seek(self, offset, where=0)
A limited seek method.
source code
 
tell(self)
Return current position in the file-like object.
source code
 
close(self)
Flush the buffer.
source code
 
flush(self)
Flush the buffer.
source code
 
__repr__(self) source code
 
__checkInt(self, i)
Might be faster just to declare them longs.
source code
 
__debugThread(self)
XXX: Only used for debugging.
source code
 
_StreamBuf__checkInt(self, i)
Might be faster just to declare them longs.
source code
 
_StreamBuf__debugThread(self)
XXX: Only used for debugging.
source code
Class Variables [hide private]
  __MIN_READ_SIZE = 1024* 2
  __MAX_BUFIO_SIZE = __MIN_READ_SIZE* 10
  __ABS_MAX_BUFIO_SIZE = __MAX_BUFIO_SIZE* 2
  __INT_CHECK_SIZE = sys.maxint-__ABS_MAX_BUFIO_SIZE-2
  VERSION = 2
  _StreamBuf__ABS_MAX_BUFIO_SIZE = 40960
  _StreamBuf__INT_CHECK_SIZE = 9223372036854734845
  _StreamBuf__MAX_BUFIO_SIZE = 20480
  _StreamBuf__MIN_READ_SIZE = 2048
Method Details [hide private]

__init__(self, stream=None, mode=None)
(Constructor)

source code 

Constructor. stream: an open file-like object.

seek(self, offset, where=0)

source code 

A limited seek method. See class __doc__ for more details.

close(self)

source code 
Flush the buffer.
NOTE: fileobject is NOT closed, just flushed. Mapping as closely as
      possible to GzipFile.

__checkInt(self, i)

source code 

Might be faster just to declare them longs. Python versions 1.5.2 & 2.1.* ONLY!

__debugThread(self)

source code 

XXX: Only used for debugging. Runs a thread that watches some tell-tale warning flags that something bad is happening.

_StreamBuf__checkInt(self, i)

source code 

Might be faster just to declare them longs. Python versions 1.5.2 & 2.1.* ONLY!

_StreamBuf__debugThread(self)

source code 

XXX: Only used for debugging. Runs a thread that watches some tell-tale warning flags that something bad is happening.