def _readMethodAttribute(self, f, index): """Read the top level details of a method attribute""" attrNameIndex = readU2(f) attrName = self._clazz._utf8Strings[attrNameIndex] # print "Name: %s" % attrName if "Code" == attrName: self._readMethodCodeAttribute(f) else: attrLen = readU4(f) f.read(attrLen)
def _readMethodCodeAttribute(self, f): """Read a method code attribute""" attrLen = readU4(f) # print "Length: %d" % attrLen # max stack readU2(f) # max locals readU2(f) codeLen = readU4(f) # print "Code length: %d" % codeLen self._code = [] codeCount = 1 while codeCount <= codeLen: self._code.append(ord(f.read(1))) codeCount += 1 f.read(attrLen - codeLen - 8)