ClassFile(InputStream) reads bytecode from an InputStream and creates a ClassFile object
from it.
store(OutputStream) generates JVM bytecode which is suitable for being processed by a Java
virtual machine, and writes it to an OutputStream.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ClassFile.Annotation
The structure of the |
| public static class | ClassFile.AnnotationDefaultAttribute
Representation of an |
| public static class | ClassFile.AnnotationsAttribute
Representation of a |
| public static class | ClassFile.ArrayElementValue
Representation of the "array_value" structure. |
| public abstract static class | ClassFile.AttributeInfo
Representation of a class file attribute (see JVMS7 4.7). |
| public static class | |
| public static class | |
| public static class | |
| public static class | |
| public static class | ClassFile.ClassFileException
Unchecked exception that represents an error condition that could occur during processing of class files, e.g. reading a corrupt class file, or an overflow of the constant pool. |
| public static class | ClassFile.CodeAttribute
Representation of an unmodifiable |
| public static class | ClassFile.ConstantClassInfo
See JVMS7 4.4.1. |
| private static class | ClassFile.ConstantDoubleInfo
See JVMS7 4.4.5. |
| public abstract static class | ClassFile.ConstantElementValue
Convenience class for element values that are constants (as opposed to annotations, enum constants and arrays). |
| public static class | ClassFile.ConstantFieldrefInfo
See JVMS7 4.4.2. |
| private static class | ClassFile.ConstantFloatInfo
See JVMS7 4.4.4. |
| private static class | ClassFile.ConstantIntegerInfo
See JVMS7 4.4.4. |
| public static class | ClassFile.ConstantInterfaceMethodrefInfo
See JVMS7 4.4.2. |
| public static class | ClassFile.ConstantInvokeDynamicInfo
See JVMS7 4.4.10. |
| private static class | ClassFile.ConstantLongInfo
See JVMS7 4.4.5. |
| public static class | ClassFile.ConstantMethodHandleInfo
See JVMS7 4.4.8. |
| public static class | ClassFile.ConstantMethodrefInfo
See JVMS7 4.4.2. |
| public static class | ClassFile.ConstantMethodTypeInfo
See JVMS7 4.4.9. |
| public static class | ClassFile.ConstantNameAndTypeInfo
See JVMS7 4.4.6. |
| public abstract static class | ClassFile.ConstantPoolInfo
Base for various the constant pool table entry types. |
| pack-priv static class | ClassFile.ConstantStringInfo
See JVMS7 4.4.3. |
| public static class | ClassFile.ConstantUtf8Info
See JVMS7 4.4.7. |
| public static class | ClassFile.ConstantValueAttribute
Representation of a |
| public abstract static class | ClassFile.ConstantValuePoolInfo
Intermediate base class for constant pool table entry types that have 'value' semantics: Double, Float, Integer, Long, String |
| public static class | ClassFile.DeprecatedAttribute
Representation of a |
| public static class | |
| public static interface | ClassFile.ElementValue
Representation of the "element_value" structure (see JVMS8 4.7.16.1). |
| public static class | ClassFile.EnumConstValue
Representation of the "enum_const_value" element in the "element_value" structure. |
| public static class | ClassFile.ExceptionsAttribute
Representation of an |
| public class | ClassFile.FieldInfo
Representation of a "method_info" structure, as defined by JVMS7 4.5. |
| public static class | |
| public static class | ClassFile.InnerClassesAttribute
Representation of an |
| public static class | |
| public static class | ClassFile.LineNumberTableAttribute
Representation of a |
| public static class | ClassFile.LocalVariableTableAttribute
Representation of a |
| public static class | |
| public class | ClassFile.MethodInfo
Representation of a "method_info" structure, as defined by JVMS7 4.6. |
| public static class | |
| public static class | ClassFile.SignatureAttribute
Representation of a |
| public static class | ClassFile.SourceFileAttribute
Representation of a |
| public static class | ClassFile.StackMapTableAttribute
Representation of an unmodifiable |
| public static class | |
| public static class | ClassFile.SyntheticAttribute
Representation of a |
| Modifier and Type | Field and Description |
|---|---|
| public final short | accessFlags
The access flags of the class. |
| private final List | attributes
The |
| private static final int | |
| private final List | |
| private final Map | |
| public final List | fieldInfos
The |
| public final short[] | interfaces
The constant pool indexes of |
| public static final short | MAJOR_VERSION_JDK_1_1
Major version number of a class file that was generated by a Java 1.1-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_10
Major version number of a class file that was generated by a Java 1.10-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_11
Major version number of a class file that was generated by a Java 1.11-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_12
Major version number of a class file that was generated by a Java 1.12-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_2
Major version number of a class file that was generated by a Java 1.2-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_3
Major version number of a class file that was generated by a Java 1.3-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_4
Major version number of a class file that was generated by a Java 1.4-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_5
Major version number of a class file that was generated by a Java 1.5-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_6
Major version number of a class file that was generated by a Java 1.6-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_7
Major version number of a class file that was generated by a Java 1.7-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_8
Major version number of a class file that was generated by a Java 1.8-compliant compiler. |
| public static final short | MAJOR_VERSION_JDK_1_9
Major version number of a class file that was generated by a Java 1.9-compliant compiler. |
| private short | |
| public final List | methodInfos
The |
| public static final short | MINOR_VERSION_JDK_1_1
Minor version number of a class file that was generated by a Java 1.1-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_10
Minor version number of a class file that was generated by a Java 1.10-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_11
Minor version number of a class file that was generated by a Java 1.11-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_12
Minor version number of a class file that was generated by a Java 1.12-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_2
Minor version number of a class file that was generated by a Java 1.2-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_3
Minor version number of a class file that was generated by a Java 1.3-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_4
Minor version number of a class file that was generated by a Java 1.4-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_5
Minor version number of a class file that was generated by a Java 1.5-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_6
Minor version number of a class file that was generated by a Java 1.6-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_7
Minor version number of a class file that was generated by a Java 1.7-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_8
Minor version number of a class file that was generated by a Java 1.8-compliant compiler. |
| public static final short | MINOR_VERSION_JDK_1_9
Minor version number of a class file that was generated by a Java 1.9-compliant compiler. |
| private short | |
| public final short | superclass
The constant pool index of the |
| public final short | thisClass
The constant pool index of the |
| Access | Constructor and Description |
|---|---|
| public | ClassFile(short
As defined by accessFlags, String org.The field descriptor for this class thisClassFd, String The field descriptor for the extended class (e.g. "Ljava/lang/Object;"); superclassFd, String[] null for
ObjectThe field descriptors for the implemented interfaces interfaceFds)Constructs a class with no fields and methods. |
| public | ClassFile(InputStream inputStream)
Reads "class file" data from the inputStream and construct a |
| Modifier and Type | Method and Description |
|---|---|
| public void | addAnnotationsAttributeEntry(boolean runtimeVisible, String fieldDescriptor, Map<Short, ClassFile.
Maps element-name constant-pool-index ( elementValuePairsConstantUtf8Info) to element valueImplements org. Runtime[In]visibleAnnotations attribute on the class (if it does not yet exist) and adds an
entry to it.
|
| private void | addAnnotationsAttributeEntry(boolean runtimeVisible, String fieldDescriptor, Map<Short, ClassFile.
Maps "elemant_name_index" ( elementValuePairs,ConstantUtf8Info) to "element_value", see JVMS8
4.7.16Adds a |
| public short | addConstantClassInfo(String typeFd)
Returns the constant index number for a "CONSTANT_Class_info" structure to the class file. |
| public short | |
| public short | addConstantFieldrefInfo(String classFd, String fieldName, String fieldFd)
Adds a "CONSTANT_Fieldref_info" structure to the class file. |
| public short | |
| public short | |
| public short | addConstantInterfaceMethodrefInfo(String classFd, String methodName, String methodMd)
Adds a "CONSTANT_InterfaceMethodref_info" structure to the class file. |
| public short | |
| public short | addConstantMethodrefInfo(String classFd, String methodName, String methodMd)
Adds a "CONSTANT_Methodref_info" structure to the class file. |
| private short | addConstantNameAndTypeInfo(String name, String descriptor)
Adds a "CONSTANT_NameAndType_info" structure to the class file. |
| private short | addConstantSifldInfo(Object cv)
Convenience method that adds a String, Integer, Float, Long or Double ConstantInfo. |
| public short | |
| public short | Returns: The index of the already existing or newly created entryAdds a "CONSTANT_Utf8_info" structure to the class file if no equal entry exists. |
| public void | |
| public ClassFile. | addFieldInfo(short accessFlags, String fieldName, String fieldTypeFd, Object constantValue)
Creates a |
| public void | addInnerClassesAttributeEntry(ClassFile.
Creates an |
| public ClassFile. | addMethodInfo(short accessFlags, String methodName, MethodDescriptor methodMd)
Creates a |
| public void | |
| private short | addToConstantPool(ClassFile.
Adds an entry to the constant pool and returns its index, or, if an equal entry already exists in the constant pool, returns the index of that entry. |
| private ClassFile. | Returns: null iff the attributes constain no attribute with that nameFinds the named attribute in the attributes. |
| public ClassFile. | getAnnotations(boolean runtimeVisible)
Implements org. |
| private ClassFile. | Returns: null if attributes constains no such attributeFinds the |
| public static String | Returns: the name of the resource, e.g. "pkg1/pkg2/Outer$Inner.class"Fully qualified class name, e.g. "pkg1.pkg2.Outer$Inner" className)Constructs the name of a resource that could contain the class file of the class with the className. |
| public ClassFile. | |
| public ClassFile. | Returns: The (read-only) constant fieldref info indexed by index
|
| public ClassFile. | Returns: The (read-only) constant interface methodref info indexed by index
|
| public ClassFile. | Returns: The (read-only) constant invoke dynamic info indexed by index
|
| public ClassFile. | Returns: The (read-only) constant method handle info indexed by index
|
| public ClassFile. | Returns: The (read-only) constant methodref info indexed by index
|
| public ClassFile. | Returns: The (read-only) constant method type info indexed by index
|
| public ClassFile. | Returns: The (read-only) constant name and type info indexed by index
|
| public ClassFile. | |
| public int | |
| public String | Returns: The string represented by the structureIndex to a index)CONSTANT_Utf8_info in the constant poolShorthand for |
| public ClassFile. | |
| public ClassFile. | Returns: The (read-only) constant value pool info indexed by index
|
| public ClassFile. | Returns: null if this class has no "InnerClasses" attributeFinds the |
| public short | |
| public short | |
| public ClassFile. | |
| public static String | Returns: the name of the resource, e.g."pkg1/pkg2/Outer.java"Fully qualified class name, e.g. className)"pkg1.pkg2.Outer$Inner"Constructs the name of a resource that could contain the source code of the class with the className. |
| public String | |
| private ClassFile. | |
| private List | |
| private void | |
| private static ClassFile. | |
| private List | |
| private ClassFile. | |
| private List | |
| public ClassFile. | |
| public ClassFile. | |
| private static byte[] | |
| private static short[] | |
| public void | setVersion(short majorVersion, short minorVersion)
Sets the major and minor class file version numbers (JVMS 4.1). |
| public void | |
| private static void | storeAttributes(DataOutputStream dos, List<ClassFile.
u2 attributes_count, attributes[attributes_count] |
| private static void | storeConstantPool(DataOutputStream dos, List<ClassFile.
u2 constant_pool_count, constant_pool[constant_pool_count - 1] |
| private static void | storeFields(DataOutputStream dos, List<ClassFile.
u2 fields_count, fields[fields_count] |
| private static void | storeMethods(DataOutputStream dos, List<ClassFile.
u2 methods_count, methods[methods_count] |
| private static void | |
| public byte[] | |
| public String |