def _read(self): self.version = self._io.read_u4be() if not self.version == 2: raise kaitaistruct.ValidationNotEqualError( 2, self.version, self._io, u"/types/header/seq/0") self.width = self._io.read_u4be() if not self.width >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.width, self._io, u"/types/header/seq/1") if not self.width <= 10000: raise kaitaistruct.ValidationGreaterThanError( 10000, self.width, self._io, u"/types/header/seq/1") self.height = self._io.read_u4be() if not self.height >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.height, self._io, u"/types/header/seq/2") if not self.height <= 10000: raise kaitaistruct.ValidationGreaterThanError( 10000, self.height, self._io, u"/types/header/seq/2") self.bytes_per_pixel = KaitaiStream.resolve_enum( GimpBrush.ColorDepth, self._io.read_u4be()) self.magic = self._io.read_bytes(4) if not self.magic == b"\x47\x49\x4D\x50": raise kaitaistruct.ValidationNotEqualError( b"\x47\x49\x4D\x50", self.magic, self._io, u"/types/header/seq/4") self.spacing = self._io.read_u4be() self.brush_name = (KaitaiStream.bytes_terminate( self._io.read_bytes_full(), 0, False)).decode(u"UTF-8")
def _read(self): self.foo = self._io.read_f4le() if not self.foo >= 0.2: raise kaitaistruct.ValidationLessThanError(0.2, self.foo, self._io, u"/seq/0") if not self.foo <= 0.4: raise kaitaistruct.ValidationGreaterThanError( 0.4, self.foo, self._io, u"/seq/0")
def _read(self): self.foo = self._io.read_bytes(2) if not self.foo >= b"\x48\x40": raise kaitaistruct.ValidationLessThanError(b"\x48\x40", self.foo, self._io, u"/seq/0") if not self.foo <= b"\x4F\x7E": raise kaitaistruct.ValidationGreaterThanError( b"\x4F\x7E", self.foo, self._io, u"/seq/0")
def _read(self): self.foo = (self._io.read_bytes(2)).decode(u"ASCII") if not self.foo >= u"H@": raise kaitaistruct.ValidationLessThanError(u"H@", self.foo, self._io, u"/seq/0") if not self.foo <= u"O~": raise kaitaistruct.ValidationGreaterThanError( u"O~", self.foo, self._io, u"/seq/0")
def _read(self): self.major = self._io.read_u1() if not self.major >= 3: raise kaitaistruct.ValidationLessThanError( 3, self.major, self._io, u"/types/rpm_version/seq/0") if not self.major <= 4: raise kaitaistruct.ValidationGreaterThanError( 4, self.major, self._io, u"/types/rpm_version/seq/0") self.minor = self._io.read_u1()
def _read(self): self._debug['day']['start'] = self._io.pos() self.day = self._io.read_bits_int_le(5) self._debug['day']['end'] = self._io.pos() if not self.day >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.day, self._io, u"/types/date/seq/0") self._debug['month']['start'] = self._io.pos() self.month = self._io.read_bits_int_le(4) self._debug['month']['end'] = self._io.pos() if not self.month >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.month, self._io, u"/types/date/seq/1") if not self.month <= 12: raise kaitaistruct.ValidationGreaterThanError( 12, self.month, self._io, u"/types/date/seq/1") self._debug['year_minus_1980']['start'] = self._io.pos() self.year_minus_1980 = self._io.read_bits_int_le(7) self._debug['year_minus_1980']['end'] = self._io.pos()
def _read(self): self.year_after_2000 = self._io.read_bits_int_be(7) self.month = self._io.read_bits_int_be(4) if not self.month >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.month, self._io, u"/types/basic_info/types/date/seq/1") if not self.month <= 12: raise kaitaistruct.ValidationGreaterThanError( 12, self.month, self._io, u"/types/basic_info/types/date/seq/1") self.day = self._io.read_bits_int_be(5) if not self.day >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.day, self._io, u"/types/basic_info/types/date/seq/2") if not self.day <= 31: raise kaitaistruct.ValidationGreaterThanError( 31, self.day, self._io, u"/types/basic_info/types/date/seq/2")
def _read(self): self.data_size = self._io.read_u4be() self.encoding = KaitaiStream.resolve_enum(Au.Encodings, self._io.read_u4be()) self.sample_rate = self._io.read_u4be() self.num_channels = self._io.read_u4be() if not self.num_channels >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.num_channels, self._io, u"/types/header/seq/3") self.comment = (KaitaiStream.bytes_terminate( self._io.read_bytes_full(), 0, False)).decode(u"ASCII")
def _read(self): self.sequence_number = self._io.read_u4be() self.width = self._io.read_u4be() if not self.width >= 1: raise kaitaistruct.ValidationLessThanError(1, self.width, self._io, u"/types/frame_control_chunk/seq/1") if not self.width <= self._root.ihdr.width: raise kaitaistruct.ValidationGreaterThanError(self._root.ihdr.width, self.width, self._io, u"/types/frame_control_chunk/seq/1") self.height = self._io.read_u4be() if not self.height >= 1: raise kaitaistruct.ValidationLessThanError(1, self.height, self._io, u"/types/frame_control_chunk/seq/2") if not self.height <= self._root.ihdr.height: raise kaitaistruct.ValidationGreaterThanError(self._root.ihdr.height, self.height, self._io, u"/types/frame_control_chunk/seq/2") self.x_offset = self._io.read_u4be() if not self.x_offset <= (self._root.ihdr.width - self.width): raise kaitaistruct.ValidationGreaterThanError((self._root.ihdr.width - self.width), self.x_offset, self._io, u"/types/frame_control_chunk/seq/3") self.y_offset = self._io.read_u4be() if not self.y_offset <= (self._root.ihdr.height - self.height): raise kaitaistruct.ValidationGreaterThanError((self._root.ihdr.height - self.height), self.y_offset, self._io, u"/types/frame_control_chunk/seq/4") self.delay_num = self._io.read_u2be() self.delay_den = self._io.read_u2be() self.dispose_op = KaitaiStream.resolve_enum(Png.DisposeOpValues, self._io.read_u1()) self.blend_op = KaitaiStream.resolve_enum(Png.BlendOpValues, self._io.read_u1())
def _read(self): self.magic = self._io.read_bytes(8) if not self.magic == b"\x42\x4F\x4F\x54\x4C\x44\x52\x21": raise kaitaistruct.ValidationNotEqualError( b"\x42\x4F\x4F\x54\x4C\x44\x52\x21", self.magic, self._io, u"/seq/0") self.revision = self._io.read_u2le() if not self.revision >= 2: raise kaitaistruct.ValidationLessThanError(2, self.revision, self._io, u"/seq/1") self.reserved1 = self._io.read_u2le() self.reserved2 = self._io.read_u4le() self.images = [] for i in range(3): self.images.append( AndroidBootldrAsus.Image(self._io, self, self._root))
def _read(self): self.magic = self._io.read_bytes(4) if not self.magic == b"\x8E\xAD\xE8\x01": raise kaitaistruct.ValidationNotEqualError( b"\x8E\xAD\xE8\x01", self.magic, self._io, u"/types/header_record/seq/0") self.reserved = self._io.read_bytes(4) if not self.reserved == b"\x00\x00\x00\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00\x00\x00\x00", self.reserved, self._io, u"/types/header_record/seq/1") self.num_index_records = self._io.read_u4be() if not self.num_index_records >= 1: raise kaitaistruct.ValidationLessThanError( 1, self.num_index_records, self._io, u"/types/header_record/seq/2") self.len_storage_section = self._io.read_u4be()
def _read(self): self.magic = self._io.read_bytes(4) if not self.magic == b"\xCA\xFE\xBA\xBE": raise kaitaistruct.ValidationNotEqualError(b"\xCA\xFE\xBA\xBE", self.magic, self._io, u"/seq/0") self.version_minor = self._io.read_u2be() self.version_major = self._io.read_u2be() if not self.version_major >= 43: raise kaitaistruct.ValidationLessThanError(43, self.version_major, self._io, u"/seq/2") self.constant_pool_count = self._io.read_u2be() self.constant_pool = [] for i in range((self.constant_pool_count - 1)): self.constant_pool.append( JavaClass.ConstantPoolEntry( (self.constant_pool[(i - 1)].is_two_entries if i != 0 else False), self._io, self, self._root)) self.access_flags = self._io.read_u2be() self.this_class = self._io.read_u2be() self.super_class = self._io.read_u2be() self.interfaces_count = self._io.read_u2be() self.interfaces = [] for i in range(self.interfaces_count): self.interfaces.append(self._io.read_u2be()) self.fields_count = self._io.read_u2be() self.fields = [] for i in range(self.fields_count): self.fields.append(JavaClass.FieldInfo(self._io, self, self._root)) self.methods_count = self._io.read_u2be() self.methods = [] for i in range(self.methods_count): self.methods.append( JavaClass.MethodInfo(self._io, self, self._root)) self.attributes_count = self._io.read_u2be() self.attributes = [] for i in range(self.attributes_count): self.attributes.append( JavaClass.AttributeInfo(self._io, self, self._root))
def _read(self): self.foo = self._io.read_u1() if not self.foo >= 123: raise kaitaistruct.ValidationLessThanError(123, self.foo, self._io, u"/seq/0")
def _read(self): self.foo = self._io.read_u1() if not self.foo >= 5: raise kaitaistruct.ValidationLessThanError(5, self.foo, self._io, u"/seq/0") if not self.foo <= 10: raise kaitaistruct.ValidationGreaterThanError(10, self.foo, self._io, u"/seq/0")