Package serp.bytecode
Class SourceFile
java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Attribute
serp.bytecode.SourceFile
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
Attribute naming the source file for this class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisit
(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.Return the file object for the source file, or null if not set.int
Return the index into the classConstantPool
of theUTF8Entry
naming the source file for this class, or 0 if not set.Return the name of the source file, or null if not set.(package private) int
Return the length of the bytecode representation of this attribute in bytes, excluding the name index.(package private) void
Read the attribute bytecode from the given stream, up to length bytes, excluding the name index.(package private) void
Copy the information from the given attribute to this one.void
Set the source file.void
Set the name of the source file.void
setFileIndex
(int sourceFileIndex) Set the index into the classConstantPool
of theUTF8Entry
naming the source file for this class.void
Set the file name from the current class name plus the .java extension.(package private) void
write
(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
-
Field Details
-
_sourceFileIndex
int _sourceFileIndex
-
-
Constructor Details
-
SourceFile
SourceFile(int nameIndex, Attributes owner)
-
-
Method Details
-
getLength
int getLength()Description copied from class:Attribute
Return the length of the bytecode representation of this attribute in bytes, excluding the name index. -
getFileIndex
public int getFileIndex()Return the index into the classConstantPool
of theUTF8Entry
naming the source file for this class, or 0 if not set. -
setFileIndex
public void setFileIndex(int sourceFileIndex) Set the index into the classConstantPool
of theUTF8Entry
naming the source file for this class. -
getFileName
Return the name of the source file, or null if not set. -
getFile
Return the file object for the source file, or null if not set.- Parameters:
dir
- the directory of the file, or null
-
setFile
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
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
Description copied from interface:VisitAcceptor
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. -
read
Description copied from class:Attribute
Copy the information from the given attribute to this one. Does nothing by default. -
read
Description copied from class:Attribute
Read the attribute bytecode from the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
read
in classAttribute
- Throws:
IOException
-
write
Description copied from class:Attribute
Write the attribute bytecode to the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
write
in classAttribute
- Throws:
IOException
-