Package cpyamf :: Module util :: Class BufferedByteStream

[hide private]
[frames] | no frames]

# Class BufferedByteStream

An extension of `StringIO`.

See Also: BufferedByteStream

Instance Methods | [hide private]

__add__(...) |

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

__len__(x) len(x) |

a new object with type S, a subtype of T

__new__(T, S, ...) |

__radd__(x, y) y+x |

__str__(...) str(x) |

append(...) Append data to the end of the stream. |

`bool`

at_eof(...) Returns `True` if the internal pointer is at the end of the stream. |

close(...) Close the stream. |

consume(...) Chops the tail off the stream starting at 0 and ending at `tell()`. |

flush(...) |

getvalue(...) Get raw data from buffer. |

peek(...) Looks `size` bytes ahead in the stream, returning what it finds, returning the stream pointer to its initial position. |

read(...) Reads `size` bytes from the stream. |

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_double(...) Reads an 8 byte float from the stream. |

read_float(...) Reads a 4 byte float 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. |

`number`

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(...) Writes the content of the specified `x` into this buffer. |

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__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`

Properties | [hide private]

| endian
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(...)
(Constructor)

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

Overrides: object.__init__

### __new__(T, S, ...)

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

### __str__(...)
(Informal representation operator)

str(x)

Overrides: object.__str__
  (inherited documentation)

### append(...)

Append data to the end of the stream. The pointer will not move if this operation is successful.

Parameters:
  - `data` (`str` or `unicode`) - The data to append to the stream.
Raises:
  - `TypeError` - data is not `str` or `unicode`

### 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.

### peek(...)

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

Parameters:
  - `size` (`int`) - Default is 1.
Returns:
  Bytes.

### remaining(...)

Returns number of remaining bytes.

Returns: `number`
  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.

Parameters:
  - `pos` (`int`)
  - `mode` (`int`)

### truncate(...)

Truncates the stream to the specified length.

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

### write(...)

Writes the content of the specified `x` into this buffer.

Parameters:
  - `x` ()

### write_24bit_int(...)

Writes a 24 bit integer to the stream.

Parameters:
  - `x` (`int`) - 24 bit integer

### write_24bit_uint(...)

Writes a 24 bit unsigned integer to the stream.

Parameters:
  - `x` (`int`) - 24 bit unsigned integer

### write_char(...)

Write a `char` to the stream.

Parameters:
  - `x` (`int`) - char
Raises:
  - `TypeError` - Unexpected type for int `x`.

### write_double(...)

Writes an 8 byte float to the stream.

Parameters:
  - `val` (`float`) - 8 byte float
Raises:
  - `TypeError` - Unexpected type for float `val`.

### write_float(...)

Writes a 4 byte float to the stream.

Parameters:
  - `x` (`float`) - 4 byte float

### write_long(...)

Writes a 4 byte integer to the stream.

Parameters:
  - `x` (`int`) - 4 byte integer

### write_short(...)

Writes a 2 byte integer to the stream.

Parameters:
  - `x` (`int`) - 2 byte integer
Raises:
  - `TypeError` - Unexpected type for int `x`.

### write_uchar(...)

Writes an `unsigned char` to the stream.

Parameters:
  - `x` (`int`) - Unsigned char
Raises:
  - `TypeError` - Unexpected type for int `x`.

### write_ulong(...)

Writes a 4 byte unsigned integer to the stream.

Parameters:
  - `x` (`int`) - 4 byte unsigned integer
Raises:
  - `TypeError` - Unexpected type for int `x`.

### write_ushort(...)

Writes a 2 byte unsigned integer to the stream.

Parameters:
  - `x` (`int`) - 2 byte unsigned integer
Raises:
  - `TypeError` - Unexpected type for int `x`.

### write_utf8_string(...)

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

Parameters:
  - `obj` - unicode object