1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.*; 28 29 32 33 public class SourceFileAttribute extends ClassAttribute { 34 35 public static final String expectedAttrName = "SourceFile"; 37 38 private ConstUtf8 sourceFileName; 39 40 41 42 46 public ConstUtf8 fileName() { 47 return sourceFileName; 48 } 49 50 53 public void setFileName(ConstUtf8 name) { 54 sourceFileName = name; 55 } 56 57 60 public SourceFileAttribute(ConstUtf8 attrName, ConstUtf8 sourceName) { 61 super(attrName); 62 sourceFileName = sourceName; 63 } 64 65 66 static SourceFileAttribute read(ConstUtf8 attrName, 67 DataInputStream data, ConstantPool pool) 68 throws IOException { 69 int index = 0; 70 index = data.readUnsignedShort(); 71 72 return new SourceFileAttribute(attrName, 73 (ConstUtf8) pool.constantAt(index)); 74 } 75 76 void write(DataOutputStream out) throws IOException { 77 out.writeShort(attrName().getIndex()); 78 out.writeInt(2); 79 out.writeShort(sourceFileName.getIndex()); 80 } 81 82 void print(PrintStream out, int indent) { 83 ClassPrint.spaces(out, indent); 84 out.println("SourceFile: " + sourceFileName.asString()); } 86 } 87 88 | Popular Tags |