vfbLib.compilers.base.StreamWriter

class vfbLib.compilers.base.StreamWriter

Bases: object

Base compiler class that writes values to the output stream. This is the parent class for the general BaseCompiler, from which all other compilers inherit, but it may be subclassed directly if more flexibility is needed.

__init__() None

Methods

__init__()

write_bytes(value)

Write binary data to the stream.

write_double(value)

write_doubles(values)

Write several double-precision floats to the stream.

write_float(value[, fmt])

Write a float value to the stream.

write_floats(values)

write_int16(value)

write_int32(value)

write_str(value[, pad])

write_uint16(value)

Write a uint16 value to the stream.

write_uint32(value)

write_uint8(value)

Write a uint8 value to the stream.

write_value(value[, shortest])

Encode and write an int value to the stream.

write_bytes(value: bytes) None

Write binary data to the stream.

Parameters:

value (bytes) – The data.

write_doubles(values: list[float]) None

Write several double-precision floats to the stream.

Parameters:

values (list[float]) – The sequence of double-precision floats to write.

write_float(value: float, fmt: str = 'd') None

Write a float value to the stream.

Parameters:
  • value (float) – The float value to write.

  • fmt (str, optional) – The format string. Defaults to “d”.

write_uint16(value: int) None

Write a uint16 value to the stream.

Parameters:

value (int) – The integer to write.

write_uint8(value: int) None

Write a uint8 value to the stream.

Parameters:

value (int) – The integer to write.

write_value(value: int, shortest=True) None

Encode and write an int value to the stream. Optionally don’t apply the length encoding optimization.

Parameters:
  • value (int) – The value to write to the stream.

  • shortest (bool, optional) – Whether to write the shortest possible representation. Defaults to True.