INNER/OUTERCLASSES

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@727 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 48d0a21c7e
commit 36bc39e386
  1. 32
      jode/jode/bytecode/BinaryInfo.java

@ -32,6 +32,8 @@ public class BinaryInfo {
public static final int METHODS = 0x04; public static final int METHODS = 0x04;
public static final int CONSTANTS = 0x08; public static final int CONSTANTS = 0x08;
public static final int ALL_ATTRIBUTES = 0x10; public static final int ALL_ATTRIBUTES = 0x10;
public static final int INNERCLASSES = 0x20;
public static final int OUTERCLASSES = 0x40;
public static final int FULLINFO = 0xff; public static final int FULLINFO = 0xff;
protected SimpleDictionary unknownAttributes; protected SimpleDictionary unknownAttributes;
@ -60,7 +62,8 @@ public class BinaryInfo {
int howMuch) throws IOException { int howMuch) throws IOException {
byte[] data = new byte[length]; byte[] data = new byte[length];
input.readFully(data); input.readFully(data);
unknownAttributes.put(name, data); if ((howMuch & ALL_ATTRIBUTES) != 0)
unknownAttributes.put(name, data);
} }
class ConstrainedInputStream extends FilterInputStream { class ConstrainedInputStream extends FilterInputStream {
@ -117,22 +120,19 @@ public class BinaryInfo {
protected void readAttributes(ConstantPool constantPool, protected void readAttributes(ConstantPool constantPool,
DataInputStream input, DataInputStream input,
int howMuch) throws IOException { int howMuch) throws IOException {
if ((howMuch & ALL_ATTRIBUTES) != 0) { int count = input.readUnsignedShort();
int count = input.readUnsignedShort(); unknownAttributes = new SimpleDictionary();
unknownAttributes = new SimpleDictionary(); for (int i=0; i< count; i++) {
for (int i=0; i< count; i++) { String attrName =
String attrName = constantPool.getUTF8(input.readUnsignedShort());
constantPool.getUTF8(input.readUnsignedShort()); final int attrLength = input.readInt();
final int attrLength = input.readInt(); ConstrainedInputStream constrInput =
ConstrainedInputStream constrInput =
new ConstrainedInputStream(attrLength, input); new ConstrainedInputStream(attrLength, input);
readAttribute(attrName, attrLength, readAttribute(attrName, attrLength,
constantPool, new DataInputStream(constrInput), constantPool, new DataInputStream(constrInput),
howMuch); howMuch);
constrInput.skipRemaining(); constrInput.skipRemaining();
} }
} else
skipAttributes(input);
} }
protected void prepareAttributes(GrowableConstantPool gcp) { protected void prepareAttributes(GrowableConstantPool gcp) {

Loading…
Cancel
Save