home *** CD-ROM | disk | FTP | other *** search
- package com.sfs.hardcore;
-
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.IOException;
-
- public class AttributeInfo {
- ConstantPoolInfo name;
- byte[] data;
-
- public String toString(ConstantPoolInfo[] var1) {
- StringBuffer var2 = new StringBuffer();
- String var3 = this.name.toString();
- if (var3.compareTo("ConstantValue") == 0) {
- ConstantPoolInfo var5 = var1[this.indexFromBytes(this.data)];
- return var5.toString();
- } else if (var3.compareTo("SourceFile") == 0) {
- ConstantPoolInfo var4 = var1[this.indexFromBytes(this.data)];
- return var4.toString();
- } else {
- var2.append(var3 + "<" + this.data.length + " bytes>");
- return var2.toString();
- }
- }
-
- public String toBoolean(ConstantPoolInfo[] var1) {
- ConstantPoolInfo var2 = var1[this.indexFromBytes(this.data)];
- return var2.intValue == 0 ? "= false" : "= true";
- }
-
- public boolean read(DataInputStream var1, ConstantPoolInfo[] var2) throws IOException {
- this.name = var2[var1.readShort()];
- int var3 = var1.readInt();
- this.data = new byte[var3];
- var3 = var1.read(this.data);
- return var3 == this.data.length;
- }
-
- public String toString() {
- return this.name.toString() + " <" + this.data.length + " bytes>";
- }
-
- public AttributeInfo(ConstantPoolInfo var1, byte[] var2) {
- this.name = this.name;
- this.data = var2;
- }
-
- public AttributeInfo() {
- }
-
- public void write(DataOutputStream var1, ConstantPoolInfo[] var2) throws IOException, Exception {
- var1.writeShort(ConstantPoolInfo.indexOf(this.name, var2));
- var1.writeInt(this.data.length);
- var1.write(this.data, 0, this.data.length);
- }
-
- short indexFromBytes(byte[] var1) {
- return (short)(var1[0] << 8 & '\uff00' | var1[1] & 255);
- }
- }
-