示例#1
0
文件: jclass.py 项目: BigManzai/jjvm
    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)
示例#2
0
  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)
示例#3
0
文件: jclass.py 项目: BigManzai/jjvm
    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)
示例#4
0
  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)