Package cpyamf :: Module util :: Class cBufferedByteStream
[hide private]
[frames] | no frames]

Class cBufferedByteStream


A file like object that can be read/written to. Supports data type specific reads/writes (e.g. ints, longs, floats etc.)

Endian aware.

Instance Methods [hide private]
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__nonzero__(x)
x != 0
 
append(...)
bool
at_eof(...)
Returns True if the internal pointer is at the end of the stream.
 
consume(...)
Chops the tail off the stream starting at 0 and ending at tell().
 
getvalue(...)
Get raw data from buffer.
 
read_24bit_int(...)
Reads a 24 bit integer from the stream.
 
read_24bit_uint(...)
Reads a 24 bit unsigned integer from the stream.
 
read_char(...)
Reads a char from the stream.
 
read_long(...)
Reads a 4 byte integer from the stream.
 
read_short(...)
Reads a 2 byte integer from the stream.
 
read_uchar(...)
Reads an unsigned char from the stream.
 
read_ulong(...)
Reads a 4 byte unsigned integer from the stream.
 
read_ushort(...)
Reads a 2 byte unsigned integer from the stream.
unicode
read_utf8_string(...)
Reads a UTF-8 string from the stream.
 
remaining(...)
Returns number of remaining bytes.
 
seek(...)
Sets the file-pointer offset, measured from the beginning of this stream, at which the next write operation will occur.
 
tell(...)
Returns the position of the stream pointer.
 
truncate(...)
Truncates the stream to the specified length.
 
write_24bit_int(...)
Writes a 24 bit integer to the stream.
 
write_24bit_uint(...)
Writes a 24 bit unsigned integer to the stream.
 
write_char(...)
Write a char to the stream.
 
write_double(...)
Writes an 8 byte float to the stream.
 
write_float(...)
Writes a 4 byte float to the stream.
 
write_long(...)
Writes a 4 byte integer to the stream.
 
write_short(...)
Writes a 2 byte integer to the stream.
 
write_uchar(...)
Writes an unsigned char to the stream.
 
write_ulong(...)
Writes a 4 byte unsigned integer to the stream.
 
write_ushort(...)
Writes a 2 byte unsigned integer to the stream.
 
write_utf8_string(...)
Writes a unicode object to the stream in UTF-8.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

consume(...)

 

Chops the tail off the stream starting at 0 and ending at tell(). The stream pointer is set to 0 at the end of this function.

seek(...)

 

Sets the file-pointer offset, measured from the beginning of this stream, at which the next write operation will occur.

Parameters:
  • mode - mode 0: absolute; 1: relative; 2: relative to EOF

truncate(...)

 

Truncates the stream to the specified length.

Parameters:
  • size (int) - The length of the stream, in bytes.

write_24bit_int(...)

 

Writes a 24 bit integer to the stream.

Parameters:
  • ret (int) - 24 bit integer

write_24bit_uint(...)

 

Writes a 24 bit unsigned integer to the stream.

Parameters:
  • ret (int) - 24 bit unsigned integer

write_char(...)

 

Write a char to the stream.

Parameters:
  • ret (int) - char

write_double(...)

 

Writes an 8 byte float to the stream.

Parameters:
  • val (float) - 8 byte float

write_float(...)

 

Writes a 4 byte float to the stream.

Parameters:
  • c (float) - 4 byte float

write_long(...)

 

Writes a 4 byte integer to the stream.

Parameters:
  • ret (int) - 4 byte integer

write_short(...)

 

Writes a 2 byte integer to the stream.

Parameters:
  • ret (int) - 2 byte integer

write_uchar(...)

 

Writes an unsigned char to the stream.

Parameters:
  • ret (int) - Unsigned char

write_ulong(...)

 

Writes a 4 byte unsigned integer to the stream.

Parameters:
  • ret (int) - 4 byte unsigned integer

write_ushort(...)

 

Writes a 2 byte unsigned integer to the stream.

Parameters:
  • ret (int) - 2 byte unsigned integer

write_utf8_string(...)

 

Writes a unicode object to the stream in UTF-8.

Parameters:
  • obj - unicode object
Raises:
  • TypeError - Unexpected type for str u.