|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalt.jiapi.file.ProgramElement
alt.jiapi.file.ClassFile
public class ClassFile
ClassFile is a low level representation of Java class file. Class file format is specified by JSR-202.
Field Summary | |
---|---|
static int |
ACC_ABSTRACT
Class is abstract |
static int |
ACC_ANNOTATION
Class is an Annotation |
static int |
ACC_ENUM
Class is an Enum |
static int |
ACC_FINAL
Final. |
static int |
ACC_INTERFACE
Class is an interface |
static int |
ACC_PUBLIC
Public access. |
static int |
ACC_SUPER
Super bit. |
static int |
ACC_SYNTHETIC
Class is synthetic |
Fields inherited from class alt.jiapi.file.ProgramElement |
---|
access_flags, attributes, constantPool |
Constructor Summary | |
---|---|
ClassFile(java.lang.String className)
Constructor to build ClassFile from scratch. |
Method Summary | |
---|---|
void |
addInterface(java.lang.String name)
Adds a new interface, that class represented by this ClassFile implements. |
java.lang.String |
getClassName()
Gets the name of the class represented by this ClassFile. |
ConstantPool |
getConstantPool()
Gets the constant pool of this ClassFile. |
java.util.List |
getFields()
Gets all the Fields of this class file |
java.util.List |
getInterfaces()
Gets all the Interfaces of this class file |
int |
getMagicNumber()
Gets the magic number |
short |
getMajorVersion()
Gets the major version of the class file |
java.util.List |
getMethods()
Gets all the Methods of this class file |
short |
getMinorVersion()
Gets the minor version of the class file |
short |
getSuperClassIndex()
Gets the index in constant-pool, that holds a class-info for super class of this class. |
java.lang.String |
getSuperclassName()
Gets the name of the superclass of the class represented by this ClassFile. |
short |
getThisClassIndex()
Gets the index in constant-pool, that holds a class-info of this class. |
static void |
main(java.lang.String[] args)
Used for testing purposes. |
static ClassFile |
parse(java.io.InputStream is)
Parse InputStream and create an instance of ClassFile from stream. |
static ClassFile |
parse(java.lang.String fileName)
Parse given file and create an instance of ClassFile from it. |
void |
setAccessFlags(short access_flags)
|
byte[] |
toBytes()
Converts this ClassFile into bytes. |
Methods inherited from class alt.jiapi.file.ProgramElement |
---|
getAccessFlags, getAttribute, getAttributes, readAttributes, writeAttributes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ACC_ABSTRACT
public static final int ACC_ANNOTATION
public static final int ACC_ENUM
public static final int ACC_FINAL
public static final int ACC_INTERFACE
public static final int ACC_PUBLIC
public static final int ACC_SUPER
public static final int ACC_SYNTHETIC
Constructor Detail |
---|
public ClassFile(java.lang.String className)
className
- fully qualified name of the class.Method Detail |
---|
public void addInterface(java.lang.String name)
fully
- qualified name of the interface to implementpublic java.lang.String getClassName()
public ConstantPool getConstantPool()
getConstantPool
in class ProgramElement
public java.util.List getFields()
public java.util.List getInterfaces()
public int getMagicNumber()
public short getMajorVersion()
public java.util.List getMethods()
public short getMinorVersion()
public short getSuperClassIndex()
public java.lang.String getSuperclassName()
public short getThisClassIndex()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- args[0] is a path to java class file
java.lang.Exception
public static ClassFile parse(java.io.InputStream is) throws ParseException, java.io.IOException
is
- InputStream
ParseException
- is thrown, if classfile parser cannot
understand parsed stream.
java.io.IOException
- is thrown, if there was problems in reading the
stream.public static ClassFile parse(java.lang.String fileName) throws ParseException, java.io.IOException
fileName
- name of the file, that is read.
ParseException
- is thrown, if classfile parser cannot
understand parsed stream.
java.io.IOException
- is thrown, if there was problems in reading the
stream.public void setAccessFlags(short access_flags)
public byte[] toBytes()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |