1 package alt.jiapi.file; 2 3 import java.io.ByteArrayOutputStream ; 4 import java.io.DataInputStream ; 5 import java.io.DataOutputStream ; 6 import java.io.IOException ; 7 import java.util.List ; 8 import java.util.LinkedList ; 9 import java.util.Iterator ; 10 11 17 public class ConstantValueAttribute extends Attribute { 18 private short[] bytes = new short[1]; 19 20 ConstantValueAttribute(short nameIndex, DataInputStream dis) throws IOException { 21 super(nameIndex); 22 bytes[0] = dis.readShort(); 23 } 24 25 public short getConstantValueIndex() { 26 return bytes[0]; 27 } 28 29 public byte[] getBytes() { 30 ByteArrayOutputStream baos = new ByteArrayOutputStream (); 31 DataOutputStream dos = new DataOutputStream (baos); 32 33 try { 34 dos.writeShort(bytes[0]); 35 } 36 catch(IOException ioe) { 37 throw new RuntimeException (ioe); 39 } 40 41 return baos.toByteArray(); 42 } 43 } 44 45 | Popular Tags |