some simplification of AttributeInfo, may not work, AttributeInfo is

removed now


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@656 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent e5a8e201b2
commit 55bc1f3da2
  1. 43
      jode/jode/bytecode/AttributeInfo.java

@ -28,25 +28,31 @@ public class AttributeInfo {
String name; String name;
byte[] data; byte[] data;
public AttributeInfo() { public AttributeInfo(String name) {
this.name = name;
}
public AttributeInfo(String name, byte[] data) {
this.name = name;
this.data = data;
} }
public void read(ConstantPool constantPool, public void read(ConstantPool constantPool,
DataInputStream input, int howMuch) throws IOException { DataInputStream input, int howMuch) throws IOException {
String attrName = constantPool.getUTF8(input.readUnsignedShort());
int length = input.readInt(); int length = input.readInt();
if ((howMuch & ClassInfo.ALL_ATTRIBUTES) != 0) { data = new byte[length];
name = attrName; input.readFully(data);
data = new byte[length]; }
input.readFully(data);
} else { public void prepareWriting(GrowableConstantPool gcp) {
while (length > 0) { gcp.putUTF8(name);
int skipped = (int) input.skip(length); }
if (skipped == 0)
throw new EOFException("Can't skip. EOF?"); public void write(GrowableConstantPool constantPool,
length -= skipped; DataOutputStream output) throws IOException {
} output.writeShort(constantPool.putUTF8(name));
} output.writeInt(data.length);
output.write(data);
} }
public String getName() { public String getName() {
@ -86,4 +92,13 @@ public class AttributeInfo {
writer.println("*/"); writer.println("*/");
} }
} }
public boolean equals(Object o) {
return (o instanceof AttributeInfo
&& ((AttributeInfo) o).name.equals(name));
}
public int hashCode() {
return name.hashCode();
}
} }

Loading…
Cancel
Save