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 SourceFileAttribute extends Attribute { 18 private short[] bytes; 19 20 SourceFileAttribute(short nameIndex, DataInputStream dis) throws IOException { 21 super(nameIndex); 22 this.bytes = new short[1]; 23 bytes[0] = dis.readShort(); 24 } 25 26 public short getSourceFileIndex() { 27 return bytes[0]; 28 } 29 30 public byte[] getBytes() { 31 ByteArrayOutputStream baos = new ByteArrayOutputStream (); 32 DataOutputStream dos = new DataOutputStream (baos); 33 34 try { 35 dos.writeShort(bytes[0]); 36 } 37 catch(IOException ioe) { 38 throw new RuntimeException (ioe); 40 } 41 42 return baos.toByteArray(); 43 } 44 } 45 46 | Popular Tags |