| 1 9 package com.vladium.jcd.cls.attribute; 10 11 import java.io.IOException ; 12 13 import com.vladium.jcd.cls.ClassDef; 14 import com.vladium.jcd.cls.constant.CONSTANT_Utf8_info; 15 import com.vladium.jcd.lib.UDataInputStream; 16 import com.vladium.jcd.lib.UDataOutputStream; 17 18 23 public 24 final class SourceFileAttribute_info extends Attribute_info 25 { 26 28 29 public int m_sourcefile_index; 30 31 32 public SourceFileAttribute_info (final int attribute_name_index) 33 { 34 super (attribute_name_index, 0); 35 } 36 37 38 public long length () 39 { 40 return 8; 41 } 42 43 public CONSTANT_Utf8_info getSourceFile (final ClassDef cls) 44 { 45 return (CONSTANT_Utf8_info) cls.getConstants ().get (m_sourcefile_index); 46 } 47 48 50 public void accept (final IAttributeVisitor visitor, final Object ctx) 51 { 52 visitor.visit (this, ctx); 53 } 54 55 public String toString () 56 { 57 return "SourceFileAttribute_info: [attribute_name_index = " + m_name_index + ", attribute_length = " + m_attribute_length + ']'; 58 } 59 60 62 65 public Object clone () 66 { 67 return super.clone (); 68 } 69 70 72 public void writeInClassFormat (final UDataOutputStream out) throws IOException  73 { 74 super.writeInClassFormat (out); 75 76 out.writeU2 (m_sourcefile_index); 77 } 78 79 81 83 84 SourceFileAttribute_info (final int attribute_name_index, final long attribute_length, 85 final UDataInputStream bytes) 86 throws IOException  87 { 88 super (attribute_name_index, attribute_length); 89 90 m_sourcefile_index = bytes.readU2 (); 91 } 92 93 95 } 98 | Popular Tags |