Package pyamf :: Package util :: Class BufferedByteStream
[hide private]
[frames] | no frames]

Class BufferedByteStream

source code


An extension of StringIO.

Features:

Instance Methods [hide private]
 
__init__(self, buf=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
array of char
read(self, length=-1)
Read bytes from stream.
source code
 
peek(self, size=1)
Looks size bytes ahead in the stream, returning what it finds, returning the stream pointer to its initial position.
source code
bool
at_eof(self)
Returns true if next.read(1) will trigger an EOFError.
source code
number
remaining(self)
Returns number of remaining bytes.
source code
 
__add__(self, other) source code

Inherited from StringIOProxy: __len__, close, flush, getvalue, next, readline, readlines, seek, tell, truncate, write, writelines

Inherited from StringIOProxy (private): _get_len, _wrapped_class

Inherited from DataTypeMixIn: read_char, read_double, read_float, read_long, read_short, read_uchar, read_ulong, read_ushort, read_utf8_string, write_char, write_double, write_float, write_long, write_short, write_uchar, write_ulong, write_ushort, write_utf8_string

Inherited from DataTypeMixIn (private): _read

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]

Inherited from DataTypeMixIn: ENDIAN_BIG, ENDIAN_LITTLE, ENDIAN_NATIVE, ENDIAN_NETWORK, endian

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, buf=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • buf (str or StringIO instance) - Initial byte stream.
Raises:
  • TypeError - Unable to coerce buf to StringIO.
Overrides: object.__init__

read(self, length=-1)

source code 

Read bytes from stream.

If we are at the end of the buffer, a EOFError is raised. If there is not enough buffer to be read and length is specified IOError is raised.

Parameters:
  • length (int) - Number of bytes to read.
Returns: array of char
The bytes read from the stream.
Raises:
  • EOFError - Reading past end of stream.
  • IOError - Length specified but not enough buffer available.
Overrides: StringIOProxy.read

peek(self, size=1)

source code 

Looks size bytes ahead in the stream, returning what it finds, returning the stream pointer to its initial position.

Parameters:
  • size (int)
Returns:
Bytes.
Raises:
  • ValueError - Trying to peek backwards.

at_eof(self)

source code 

Returns true if next.read(1) will trigger an EOFError.

Returns: bool

remaining(self)

source code 

Returns number of remaining bytes.

Returns: number
Number of remaining bytes.