#!/usr/bin/python -u # -*- coding: utf-8 -*- from struct import unpack class AXMLReader(): """Provide various read helpers.""" def __init__(self, data): self._data = data self._position = 0 self._length = len(self._data) def readInt(self): """Read a 4-bytes value.""" self.skipInt() value = unpack(' self._length: raise Exception("Reader out of bound (%d > %d)!" % (self._position, self._length)) def readIntArray(self, length): """Read an array composed of 4-bytes values.""" return [ self.readInt() for i in range(0, length) ]