| 286 | return struct.unpack('>I', values_length)[0] |
| 287 | |
| 288 | def array_type(self): |
| 289 | if not self.array_description: |
| 290 | raise Exception('Empty NewArray description') |
| 291 | if self.array_description.__class__ is not ClassDesc: |
| 292 | raise Exception('Unsupported NewArray description class') |
| 293 | desc = self.array_description.description |
| 294 | if desc.__class__ is Reference: |
| 295 | ref = desc.handle - Constants.BASE_WIRE_HANDLE |
| 296 | desc = self.stream.references[ref] |
| 297 | if desc.class_name.contents[0] != '[': # array |
| 298 | raise Exception('Unsupported NewArray description') |
| 299 | decoded_type = desc.class_name.contents[1] |
| 300 | if decoded_type in Constants.PRIMITIVE_TYPE_CODES.keys(): |
| 301 | return Constants.PRIMITIVE_TYPE_CODES[decoded_type] |
| 302 | elif decoded_type == 'L': # object |
| 303 | return desc.class_name.contents[2:desc.class_name.contents.index(';')] |
| 304 | else: |
| 305 | raise Exception('Unsupported NewArray Type') |
| 306 | |
| 307 | def decode_value(self, io): |
| 308 | if self.type == 'byte': |