def read_data(self, inp): self.boolean = inp.read_boolean() self.b = inp.read_byte() self.c = inp.read_char() self.d = inp.read_double() self.s = inp.read_short() self.f = inp.read_float() self.i = inp.read_int() self.l = inp.read_long() self.string = inp.read_utf() self.booleans = inp.read_boolean_array() self.bytes_ = inp.read_byte_array() self.chars = inp.read_char_array() self.doubles = inp.read_double_array() self.shorts = inp.read_short_array() self.floats = inp.read_float_array() self.ints = inp.read_int_array() self.longs = inp.read_long_array() self.strings = inp.read_utf_array() self.booleans_none = inp.read_boolean_array() self.bytes_none = inp.read_byte_array() self.chars_none = inp.read_char_array() self.doubles_none = inp.read_double_array() self.shorts_none = inp.read_short_array() self.floats_none = inp.read_float_array() self.ints_none = inp.read_int_array() self.longs_none = inp.read_long_array() self.strings_none = inp.read_utf_array() self.bytes_size = inp.read_byte() self.bytes_fully = bytearray(self.bytes_size) inp.read_into(self.bytes_fully) self.bytes_offset = bytearray(2) inp.read_into(self.bytes_offset, 0, 2) str_size = inp.read_int() self.str_chars = [] for _ in range(str_size): self.str_chars.append(inp.read_char()) self.str_bytes = bytearray(str_size) inp.read_into(self.str_bytes) self.unsigned_byte = inp.read_unsigned_byte() self.unsigned_short = to_signed(inp.read_unsigned_short(), 16) self.portable = inp.read_object() self.identified = inp.read_object() self.custom_byte_array_serializable = inp.read_object() self.custom_serializable = inp.read_object() self.data = _read_data_from_inp(inp)
def read_portable(self, reader): self.boolean = reader.read_boolean("bool") self.b = reader.read_byte("b") self.c = reader.read_char("c") self.d = reader.read_double("d") self.s = reader.read_short("s") self.f = reader.read_float("f") self.i = reader.read_int("i") self.l = reader.read_long("l") self.string = reader.read_utf("str") self.p = reader.read_portable("p") self.booleans = reader.read_boolean_array("booleans") self.bytes_ = reader.read_byte_array("bs") self.chars = reader.read_char_array("cs") self.doubles = reader.read_double_array("ds") self.shorts = reader.read_short_array("ss") self.floats = reader.read_float_array("fs") self.ints = reader.read_int_array("is") self.longs = reader.read_long_array("ls") self.strings = reader.read_utf_array("strs") self.portables = reader.read_portable_array("ps") self.booleans_none = reader.read_boolean_array("booleansNull") self.bytes_none = reader.read_byte_array("bsNull") self.chars_none = reader.read_char_array("csNull") self.doubles_none = reader.read_double_array("dsNull") self.shorts_none = reader.read_short_array("ssNull") self.floats_none = reader.read_float_array("fsNull") self.ints_none = reader.read_int_array("isNull") self.longs_none = reader.read_long_array("lsNull") self.strings_none = reader.read_utf_array("strsNull") inp = reader.get_raw_data_input() self.boolean = inp.read_boolean() self.b = inp.read_byte() self.c = inp.read_char() self.d = inp.read_double() self.s = inp.read_short() self.f = inp.read_float() self.i = inp.read_int() self.l = inp.read_long() self.string = inp.read_utf() self.booleans = inp.read_boolean_array() self.bytes_ = inp.read_byte_array() self.chars = inp.read_char_array() self.doubles = inp.read_double_array() self.shorts = inp.read_short_array() self.floats = inp.read_float_array() self.ints = inp.read_int_array() self.longs = inp.read_long_array() self.strings = inp.read_utf_array() self.booleans_none = inp.read_boolean_array() self.bytes_none = inp.read_byte_array() self.chars_none = inp.read_char_array() self.doubles_none = inp.read_double_array() self.shorts_none = inp.read_short_array() self.floats_none = inp.read_float_array() self.ints_none = inp.read_int_array() self.longs_none = inp.read_long_array() self.strings_none = inp.read_utf_array() self.bytes_size = inp.read_byte() self.bytes_fully = bytearray(self.bytes_size) inp.read_into(self.bytes_fully) self.bytes_offset = bytearray(2) inp.read_into(self.bytes_offset, 0, 2) str_size = inp.read_int() self.str_chars = [] for _ in range(str_size): self.str_chars.append(inp.read_char()) self.str_bytes = bytearray(str_size) inp.read_into(self.str_bytes) self.unsigned_byte = inp.read_unsigned_byte() self.unsigned_short = to_signed(inp.read_unsigned_short(), 16) self.p = inp.read_object() self.identified = inp.read_object() self.custom_byte_array_serializable = inp.read_object() self.custom_serializable = inp.read_object() self.data = _read_data_from_inp(inp)
def write(self, out, obj): i = obj.int msb = to_signed(i >> UUID_MSB_SHIFT, 64) lsb = to_signed(i & UUID_LSB_MASK, 64) out.write_long(msb) out.write_long(lsb)