Package serp.bytecode
Class SourceFile
- java.lang.Object
-
- serp.bytecode.Attributes
-
- serp.bytecode.Attribute
-
- serp.bytecode.SourceFile
-
- All Implemented Interfaces:
BCEntity,VisitAcceptor
public class SourceFile extends Attribute
Attribute naming the source file for this class.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int_sourceFileIndex
-
Constructor Summary
Constructors Constructor Description SourceFile(int nameIndex, Attributes owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisit(BCVisitor visit)Accept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.java.io.FilegetFile(java.io.File dir)Return the file object for the source file, or null if not set.intgetFileIndex()Return the index into the classConstantPoolof theUTF8Entrynaming the source file for this class, or 0 if not set.java.lang.StringgetFileName()Return the name of the source file, or null if not set.(package private) intgetLength()Return the length of the bytecode representation of this attribute in bytes, excluding the name index.(package private) voidread(java.io.DataInput in, int length)Read the attribute bytecode from the given stream, up to length bytes, excluding the name index.(package private) voidread(Attribute other)Copy the information from the given attribute to this one.voidsetFile(java.io.File file)Set the source file.voidsetFile(java.lang.String name)Set the name of the source file.voidsetFileIndex(int sourceFileIndex)Set the index into the classConstantPoolof theUTF8Entrynaming the source file for this class.voidsetFromClassName()Set the file name from the current class name plus the .java extension.(package private) voidwrite(java.io.DataOutput out, int length)Write the attribute bytecode to the given stream, up to length bytes, excluding the name index.-
Methods inherited from class serp.bytecode.Attribute
create, getAttributesHolder, getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, invalidate, isValid
-
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, readAttributes, removeAttribute, removeAttribute, setAttributes, visitAttributes, writeAttributes
-
-
-
-
Constructor Detail
-
SourceFile
SourceFile(int nameIndex, Attributes owner)
-
-
Method Detail
-
getLength
int getLength()
Description copied from class:AttributeReturn the length of the bytecode representation of this attribute in bytes, excluding the name index.
-
getFileIndex
public int getFileIndex()
Return the index into the classConstantPoolof theUTF8Entrynaming the source file for this class, or 0 if not set.
-
setFileIndex
public void setFileIndex(int sourceFileIndex)
Set the index into the classConstantPoolof theUTF8Entrynaming the source file for this class.
-
getFileName
public java.lang.String getFileName()
Return the name of the source file, or null if not set.
-
getFile
public java.io.File getFile(java.io.File dir)
Return the file object for the source file, or null if not set.- Parameters:
dir- the directory of the file, or null
-
setFile
public void setFile(java.lang.String name)
Set the name of the source file. The name should be the file name only; it should not include the path to the file.
-
setFile
public void setFile(java.io.File file)
Set the source file. Note that only the file name is recorded; the path to the file is discarded.
-
setFromClassName
public void setFromClassName()
Set the file name from the current class name plus the .java extension.
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptorAccept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
-
read
void read(Attribute other)
Description copied from class:AttributeCopy the information from the given attribute to this one. Does nothing by default.
-
read
void read(java.io.DataInput in, int length) throws java.io.IOExceptionDescription copied from class:AttributeRead the attribute bytecode from the given stream, up to length bytes, excluding the name index. Does nothing by default.
-
write
void write(java.io.DataOutput out, int length) throws java.io.IOExceptionDescription copied from class:AttributeWrite the attribute bytecode to the given stream, up to length bytes, excluding the name index. Does nothing by default.
-
-