示例#1
0
  private void parseAttributes() throws IOException {
    int attributesCount = in.readUnsignedShort();
    attributes = new AttributeInfo[attributesCount];

    for (int i = 0; i < attributesCount; i++) {
      attributes[i] = parseAttribute();

      // Section 4.7.7 of VM Spec - Class File Format
      if (attributes[i].getName() != null && attributes[i].getName().equals("SourceFile")) {
        byte[] b = attributes[i].getValue();
        int b0 = b[0] < 0 ? b[0] + 256 : b[0];
        int b1 = b[1] < 0 ? b[1] + 256 : b[1];
        int pe = b0 * 256 + b1;

        String descriptor = toUTF8(pe);
        jClass.setSourceFile(descriptor);
      }
    }
  }