Bases: object
An abstract writer of bytes. Note that due to endianness concerns, the methods of this writer should be used directly for the appropriate data type being written; e.g. an int should be written using write_int rather than calling write_byte 4 times with the parts of the int unless a specific endianness is being achieved.
Abstract Methods
| get_n_bytes_written() | Determines how many bytes have been written in total |
| write_byte(byte_value) | Writes the lowest order byte of the given value |
| write_int(int_value) | Writes a four byte value |
| write_long(long_value) | Writes an eight byte value |
| write_short(short_value) | Writes the two lowest order bytes of the given value |
Methods
| write_bytes(byte_iterable) | Writes a set of bytes |
Detailed Methods
Determines how many bytes have been written in total
| Returns: | The number of bytes written |
|---|---|
| Return type: | int |
| Raises None: | No known exception is raised |
Writes the lowest order byte of the given value
| Parameters: | byte_value (int) – The byte to write |
|---|---|
| Returns: | Nothing is returned |
| Return type: | None |
| Raises IOError: | If there is an error writing to the stream |
Writes a set of bytes
| Parameters: | byte_iterable (iterable of bytes) – The bytes to write |
|---|---|
| Returns: | Nothing is returned |
| Return type: | None |
| Raises IOError: | If there is an error writing to the stream |
Writes a four byte value
| Parameters: | int_value (int) – The integer to write |
|---|---|
| Returns: | Nothing is returned |
| Return type: | None |
| Raises IOError: | If there is an error writing to the stream |