Previous topic

spinnman.data.abstract_byte_reader module

Next topic

spinnman.data.abstract_data_reader module

This Page

spinnman.data.abstract_byte_writer module

class spinnman.data.abstract_byte_writer.AbstractByteWriter[source]

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

get_n_bytes_written()[source]

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
write_byte(byte_value)[source]

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
write_bytes(byte_iterable)[source]

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
write_int(int_value)[source]

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
write_long(long_value)[source]

Writes an eight byte value

Parameters:long_value (long) – The long to write
Returns:Nothing is returned
Return type:None
Raises IOError:If there is an error writing to the stream
write_short(short_value)[source]

Writes the two lowest order bytes of the given value

Parameters:short_value (int) – The short to write
Returns:Nothing is returned
Return type:None
Raises IOError:If there is an error writing to the stream