| java.lang.Object org.codehaus.janino.util.ClassFile
Inner Class :abstract public static class ConstantPoolInfo | |
Inner Class :abstract public static class ConstantValuePoolInfo extends ConstantPoolInfo | |
Inner Class :public static class ConstantClassInfo extends ConstantPoolInfo | |
Inner Class :public static class ConstantFieldrefInfo extends ConstantPoolInfo | |
Inner Class :public static class ConstantMethodrefInfo extends ConstantPoolInfo | |
Inner Class :public static class ConstantInterfaceMethodrefInfo extends ConstantPoolInfo | |
Inner Class :static class ConstantStringInfo extends ConstantValuePoolInfo | |
Inner Class :public static class ConstantNameAndTypeInfo extends ConstantPoolInfo | |
Inner Class :public static class ConstantUtf8Info extends ConstantPoolInfo | |
Inner Class :public class MethodInfo | |
Inner Class :public static class FieldInfo | |
Inner Class :abstract public static class AttributeInfo | |
Inner Class :public static class ConstantValueAttribute extends AttributeInfo | |
Inner Class :public static class ExceptionsAttribute extends AttributeInfo | |
Inner Class :public static class InnerClassesAttribute extends AttributeInfo | |
Inner Class :public static class SyntheticAttribute extends AttributeInfo | |
Inner Class :public static class SourceFileAttribute extends AttributeInfo | |
Inner Class :public static class LineNumberTableAttribute extends AttributeInfo | |
Inner Class :public static class LocalVariableTableAttribute extends AttributeInfo | |
Inner Class :public static class DeprecatedAttribute extends AttributeInfo | |
Constructor Summary | |
public | ClassFile(short accessFlags, String thisClassFD, String superclassFD, String[] interfaceFDs) Construct from parsed components.
Parameters: accessFlags - as defined by org.codehaus.janino.Mod Parameters: thisClassFD - the field descriptor for this class Parameters: superclassFD - the field descriptor for the extended class (e.g. | public | ClassFile(InputStream inputStream) Read "class file" data from a
InputStream and construct a
ClassFile object from it.
If the
ClassFile is created with this constructor, then most modifying operations
lead to a
UnsupportedOperationException ; only fields, methods and
attributes can be added. |
Method Summary | |
public short | addConstantClassInfo(String typeFD) Add a "CONSTANT_Class_info" structure to the class file. | public short | addConstantDoubleInfo(double value) Add a "CONSTANT_Double_info" structure to the class file. | public short | addConstantFieldrefInfo(String classFD, String fieldName, String fieldFD) Add a "CONSTANT_Fieldref_info" structure to the class file. | public short | addConstantFloatInfo(float value) Add a "CONSTANT_Float_info" structure to the class file. | public short | addConstantIntegerInfo(int value) Add a "CONSTANT_Integer_info" structure to the class file. | public short | addConstantInterfaceMethodrefInfo(String classFD, String methodName, String methodMD) Add a "CONSTANT_InterfaceMethodref_info" structure to the class file. | public short | addConstantLongInfo(long value) Add a "CONSTANT_Long_info" structure to the class file. | public short | addConstantMethodrefInfo(String classFD, String methodName, String methodMD) Add a "CONSTANT_Methodref_info" structure to the class file. | public short | addConstantStringInfo(String string) Add a "CONSTANT_String_info" structure to the class file. | public short | addConstantUtf8Info(String s) Add a "CONSTANT_Utf8_info" structure to the class file. | public void | addDeprecatedAttribute() | public FieldInfo | addFieldInfo(short accessFlags, String fieldName, String fieldTypeFD, Object optionalConstantValue) | public void | addInnerClassesAttributeEntry(InnerClassesAttribute.Entry e) Create an "InnerClasses" attribute if it does not exist, then add the given entry
to the "InnerClasses" attribute. | public MethodInfo | addMethodInfo(short accessFlags, String methodName, String methodMD) | public void | addSourceFileAttribute(String sourceFileName) Adds a "SourceFile" attribute to this class file. | public static String | getClassFileResourceName(String className) Construct the name of a resource that could contain the class file of the
class with the given name.
Parameters: className - Fully qualified class name, e.g. | public String | getConstantClassName(short index) | public ConstantPoolInfo | getConstantPoolInfo(short index) | public String | getConstantUtf8(short index) | public InnerClassesAttribute | getInnerClassesAttribute() | public short | getMajorVersion() Returns the current major class file version number. | public short | getMinorVersion() Returns the current minor class file version number. | public static String | getSourceResourceName(String className) Construct the name of a resource that could contain the source code of
the class with the given name.
Notice that member types are declared inside a different type, so the relevant source file
is that of the outermost declaring class.
Parameters: className - Fully qualified class name, e.g. | public String | getThisClassName() The fully qualified name of this class, e.g. | public static boolean | isRecognizedVersion(short majorVersion, short minorVersion) | public void | setVersion(short majorVersion, short minorVersion) Sets the major and minor class file version numbers (JVMS 4.1). | public void | store(OutputStream os) Write
ClassFile to an
OutputStream , in "class file" format.
Notice that if an
IOException is thrown, the class file is
probably written incompletely and thus invalid. | public byte[] | toByteArray() Return the byte code of this
ClassFile as a byte array. |
MAJOR_VERSION_JDK_1_1 | final public static short MAJOR_VERSION_JDK_1_1(Code) | | |
MAJOR_VERSION_JDK_1_2 | final public static short MAJOR_VERSION_JDK_1_2(Code) | | |
MAJOR_VERSION_JDK_1_3 | final public static short MAJOR_VERSION_JDK_1_3(Code) | | |
MAJOR_VERSION_JDK_1_4 | final public static short MAJOR_VERSION_JDK_1_4(Code) | | |
MAJOR_VERSION_JDK_1_5 | final public static short MAJOR_VERSION_JDK_1_5(Code) | | |
MINOR_VERSION_JDK_1_1 | final public static short MINOR_VERSION_JDK_1_1(Code) | | |
MINOR_VERSION_JDK_1_2 | final public static short MINOR_VERSION_JDK_1_2(Code) | | |
MINOR_VERSION_JDK_1_3 | final public static short MINOR_VERSION_JDK_1_3(Code) | | |
MINOR_VERSION_JDK_1_4 | final public static short MINOR_VERSION_JDK_1_4(Code) | | |
MINOR_VERSION_JDK_1_5 | final public static short MINOR_VERSION_JDK_1_5(Code) | | |
accessFlags | public short accessFlags(Code) | | |
interfaces | public short[] interfaces(Code) | | |
superclass | public short superclass(Code) | | |
thisClass | public short thisClass(Code) | | |
ClassFile | public ClassFile(short accessFlags, String thisClassFD, String superclassFD, String[] interfaceFDs)(Code) | | Construct from parsed components.
Parameters: accessFlags - as defined by org.codehaus.janino.Mod Parameters: thisClassFD - the field descriptor for this class Parameters: superclassFD - the field descriptor for the extended class (e.g. "Ljava/lang/Object;") Parameters: interfaceFDs - the field descriptors for the implemented interfaces |
addDeprecatedAttribute | public void addDeprecatedAttribute()(Code) | | |
addFieldInfo | public FieldInfo addFieldInfo(short accessFlags, String fieldName, String fieldTypeFD, Object optionalConstantValue)(Code) | | |
addInnerClassesAttributeEntry | public void addInnerClassesAttributeEntry(InnerClassesAttribute.Entry e)(Code) | | Create an "InnerClasses" attribute if it does not exist, then add the given entry
to the "InnerClasses" attribute.
Parameters: e - |
addMethodInfo | public MethodInfo addMethodInfo(short accessFlags, String methodName, String methodMD)(Code) | | |
addSourceFileAttribute | public void addSourceFileAttribute(String sourceFileName)(Code) | | Adds a "SourceFile" attribute to this class file. (Does not check whether one exists already.)
Parameters: sourceFileName - |
getClassFileResourceName | public static String getClassFileResourceName(String className)(Code) | | Construct the name of a resource that could contain the class file of the
class with the given name.
Parameters: className - Fully qualified class name, e.g. "pkg1.pkg2.Outer$Inner" the name of the resource, e.g. "pkg1/pkg2/Outer$Inner.class" |
getConstantClassName | public String getConstantClassName(short index)(Code) | | Parameters: index - Index to a CONSTANT_Class_info in the constant pool The name of the denoted class in "internal form" (see JVMS 4.2) |
getConstantPoolInfo | public ConstantPoolInfo getConstantPoolInfo(short index)(Code) | | |
getConstantUtf8 | public String getConstantUtf8(short index)(Code) | | Parameters: index - Index to a CONSTANT_Utf8_info in the constant pool The string represented by the structure |
getInnerClassesAttribute | public InnerClassesAttribute getInnerClassesAttribute()(Code) | | Find the "InnerClasses" attribute of this class file
null if this class has no "InnerClasses" attribute |
getMajorVersion | public short getMajorVersion()(Code) | | Returns the current major class file version number.
|
getMinorVersion | public short getMinorVersion()(Code) | | Returns the current minor class file version number.
|
getSourceResourceName | public static String getSourceResourceName(String className)(Code) | | Construct the name of a resource that could contain the source code of
the class with the given name.
Notice that member types are declared inside a different type, so the relevant source file
is that of the outermost declaring class.
Parameters: className - Fully qualified class name, e.g. "pkg1.pkg2.Outer$Inner" the name of the resource, e.g. "pkg1/pkg2/Outer.java" |
getThisClassName | public String getThisClassName()(Code) | | The fully qualified name of this class, e.g. "pkg1.pkg2.Outer$Inner" |
isRecognizedVersion | public static boolean isRecognizedVersion(short majorVersion, short minorVersion)(Code) | | |
setVersion | public void setVersion(short majorVersion, short minorVersion)(Code) | | Sets the major and minor class file version numbers (JVMS 4.1). The class file version
defaults to the JDK 1.1 values (45.3) which execute on virtually every JVM.
Parameters: majorVersion - Parameters: minorVersion - |
store | public void store(OutputStream os) throws IOException(Code) | | Write
ClassFile to an
OutputStream , in "class file" format.
Notice that if an
IOException is thrown, the class file is
probably written incompletely and thus invalid. The calling method must take
care of this situation, e.g. by closing the output stream and then deleting the
file.
Parameters: os - throws: IOException - |
toByteArray | public byte[] toByteArray()(Code) | | Return the byte code of this
ClassFile as a byte array.
|
|
|