1 package alt.jiapi.file; 2 3 import java.io.DataInputStream ; 4 import java.io.IOException ; 5 6 11 public class Attribute { 12 private short attribute_name_index; 13 private byte[] bytes; 14 protected ConstantPool cp; 15 16 protected Attribute(short nameIndex) { 17 this.attribute_name_index = nameIndex; 18 } 19 20 Attribute(short nameIndex, int length, DataInputStream dis) throws IOException { 21 this.attribute_name_index = nameIndex; 22 this.bytes = new byte[length]; 23 24 for (int i = 0; i < length; i++) { 25 bytes[i] = dis.readByte(); 26 } 27 } 28 29 34 public byte[] getBytes() { 35 return bytes; 36 } 37 38 43 public String getName() { 44 return cp.getUtf8(attribute_name_index); 45 } 46 47 short getAttributeNameIndex() { 48 return attribute_name_index; 49 } 50 51 void setConstantPool(ConstantPool cp) { 52 this.cp = cp; 53 } 54 } 55 56 | Popular Tags |