def write_int(self, value): self._ensure_available(INT_SIZE_IN_BYTES) BE_INT.pack_into(self._buf, self._pos, value) self._pos += INT_SIZE_IN_BYTES
def write(self, out, obj): buf = bytearray(10) BE_INT.pack_into(buf, 0, obj.i) BE_FLOAT.pack_into(buf, 4, obj.f) out.write_byte_array(buf)