harpoon.IR.RawClass
Class AttributeSourceFile

java.lang.Object
  extended by harpoon.IR.RawClass.Attribute
      extended by harpoon.IR.RawClass.AttributeSourceFile

public class AttributeSourceFile
extends Attribute

The SourceFile attribute is an optional fixed-length attribute in the attributes table of the ClassFile structure. There can be no more than one SourceFile attribute in the attributes table of a given ClassFile structure.

Only the name of the source file is given by the SourceFile attribute. It never represents tha name of a directory containing the file or an absolute path name for the file. For instance, the SourceFile attribute might contain the file name foo.java but not the UNIX pathname /home/lindholm/foo.java.

Version:
$Id: AttributeSourceFile.java,v 1.3 2003/09/05 21:45:16 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
"The Java Virtual Machine Specification, section 4.7.2", Attribute, ClassFile

Field Summary
static String ATTRIBUTE_NAME
          The string naming this Attribute type.
 int sourcefile_index
          The value of the sourcefile_index item must be a valid index into the constant_pool table.
 
Fields inherited from class harpoon.IR.RawClass.Attribute
attribute_name_index, parent
 
Constructor Summary
AttributeSourceFile(ClassFile parent, int attribute_name_index, int sourcefile_index)
          Constructor.
 
Method Summary
 long attribute_length()
          The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.
 void print(PrintWriter pw, int indent)
          Pretty-print this attribute structure.
 ConstantUtf8 sourcefile_index()
           
 String sourcefile()
           
 void write(ClassDataOutputStream out)
          Write to bytecode stream.
 
Methods inherited from class harpoon.IR.RawClass.Attribute
attribute_name_index, attribute_name, read, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
The string naming this Attribute type.

See Also:
Constant Field Values

sourcefile_index

public int sourcefile_index
The value of the sourcefile_index item must be a valid index into the constant_pool table. The constant pool entry at that index must be a CONSTANT_Utf8_info structure representing the string giving the name of the source file from which this class file was compiled.

Constructor Detail

AttributeSourceFile

public AttributeSourceFile(ClassFile parent,
                           int attribute_name_index,
                           int sourcefile_index)
Constructor.

Method Detail

attribute_length

public long attribute_length()
Description copied from class: Attribute
The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes.

Specified by:
attribute_length in class Attribute

sourcefile_index

public ConstantUtf8 sourcefile_index()

sourcefile

public String sourcefile()

write

public void write(ClassDataOutputStream out)
           throws IOException
Write to bytecode stream.

Specified by:
write in class Attribute
Throws:
IOException

print

public void print(PrintWriter pw,
                  int indent)
Pretty-print this attribute structure.

Overrides:
print in class Attribute
Parameters:
indent - the indentation level to use.