org.eclipse.jdt.internal.compiler.classfmt
类 ClassFileReader

java.lang.Object
  继承者 org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct
      继承者 org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader
所有已实现的接口:
IBinaryType, IDependent, IGenericType

public class ClassFileReader
extends ClassFileStruct
implements IBinaryType


字段摘要
 
从接口 org.eclipse.jdt.internal.compiler.env.IBinaryType 继承的字段
NoField, NoInterface, NoMethod, NoNestedType
 
从接口 org.eclipse.jdt.internal.compiler.env.IDependent 继承的字段
JAR_FILE_ENTRY_SEPARATOR
 
构造方法摘要
ClassFileReader(byte[] classFileBytes, char[] fileName)
           
ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInitialize)
           
 
方法摘要
 int accessFlags()
          Answer the receiver's access flags.
 IBinaryAnnotation[] getAnnotations()
          Answer the runtime visible and invisible annotations for this type or null if none.
 int[] getConstantPoolOffsets()
          Answer the int array that corresponds to all the offsets of each entry in the constant pool
 char[] getEnclosingMethod()
          Answer the enclosing method (including method selector and method descriptor), or null if none.
 char[] getEnclosingTypeName()
          Answer the resolved name of the enclosing type in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the receiver is a top level type.
 IBinaryField[] getFields()
          Answer the receiver's this.fields or null if the array is empty.
 char[] getFileName()
          Answer the file name which defines the type.
 char[] getGenericSignature()
          Answer the receiver's signature which describes the parameter & return types as specified in section 4.4.4 of the Java 2 VM spec 3rd edition.
 char[] getInnerSourceName()
          Answer the source name if the receiver is a inner type.
 char[][] getInterfaceNames()
          Answer the resolved names of the receiver's interfaces in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the array is empty.
 IBinaryNestedType[] getMemberTypes()
          Answer the receiver's nested types or null if the array is empty.
 IBinaryMethod[] getMethods()
          Answer the receiver's this.methods or null if the array is empty.
 char[][][] getMissingTypeNames()
          Answer the list of missing type names which were referenced from the problem classfile.
 int getModifiers()
          Answer an int whose bits are set according the access constants defined by the VM spec.
 char[] getName()
          Answer the resolved name of the type in the class file format as specified in section 4.2 of the Java 2 VM spec.
 char[] getSourceName()
          Answer the simple name of the type in the class file.
 char[] getSuperclassName()
          Answer the resolved name of the receiver's superclass in the class file format as specified in section 4.2 of the Java 2 VM spec or null if it does not have one.
 long getTagBits()
          Answer the tagbits set according to the bits for annotations.
 long getVersion()
          Answer the major/minor version defined in this class file according to the VM spec.
 boolean hasStructuralChanges(byte[] newBytes)
          Check if the receiver has structural changes compare to the byte array in argument.
 boolean hasStructuralChanges(byte[] newBytes, boolean orderRequired, boolean excludesSynthetic)
          Check if the receiver has structural changes compare to the byte array in argument.
 boolean isAnonymous()
          Answer true if the receiver is an anonymous type, false otherwise
 boolean isBinaryType()
          Answer whether the receiver contains the resolved binary form or the unresolved source form of the type.
 boolean isLocal()
          Answer true if the receiver is a local type, false otherwise
 boolean isMember()
          Answer true if the receiver is a member type, false otherwise
 boolean isNestedType()
          Answer true if the receiver is a nested type, false otherwise
static ClassFileReader read(File file)
           
static ClassFileReader read(File file, boolean fullyInitialize)
           
static ClassFileReader read(InputStream stream, String fileName)
           
static ClassFileReader read(InputStream stream, String fileName, boolean fullyInitialize)
           
static ClassFileReader read(String fileName)
           
static ClassFileReader read(String fileName, boolean fullyInitialize)
           
static ClassFileReader read(ZipFile zip, String filename)
           
static ClassFileReader read(ZipFile zip, String filename, boolean fullyInitialize)
           
 char[] sourceFileName()
          Answer the source file name attribute.
 String toString()
           
 
从类 org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct 继承的方法
doubleAt, floatAt, i4At, i8At, reset, u1At, u2At, u4At, utf8At
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

ClassFileReader

public ClassFileReader(byte[] classFileBytes,
                       char[] fileName)
                throws ClassFormatException
参数:
classFileBytes - Actual bytes of a .class file
fileName - Actual name of the file that contains the bytes, can be null
抛出:
ClassFormatException

ClassFileReader

public ClassFileReader(byte[] classFileBytes,
                       char[] fileName,
                       boolean fullyInitialize)
                throws ClassFormatException
参数:
classFileBytes - byte[] Actual bytes of a .class file
fileName - char[] Actual name of the file that contains the bytes, can be null
fullyInitialize - boolean Flag to fully initialize the new object
抛出:
ClassFormatException
方法详细信息

read

public static ClassFileReader read(File file)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(File file,
                                   boolean fullyInitialize)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(InputStream stream,
                                   String fileName)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(InputStream stream,
                                   String fileName,
                                   boolean fullyInitialize)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(ZipFile zip,
                                   String filename)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(ZipFile zip,
                                   String filename,
                                   boolean fullyInitialize)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(String fileName)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

read

public static ClassFileReader read(String fileName,
                                   boolean fullyInitialize)
                            throws ClassFormatException,
                                   IOException
抛出:
ClassFormatException
IOException

accessFlags

public int accessFlags()
Answer the receiver's access flags. The value of the access_flags item is a mask of modifiers used with class and interface declarations.

返回:
int

getAnnotations

public IBinaryAnnotation[] getAnnotations()
从接口 IBinaryType 复制的描述
Answer the runtime visible and invisible annotations for this type or null if none.

指定者:
接口 IBinaryType 中的 getAnnotations
返回:
the annotations or null if there is none.

getConstantPoolOffsets

public int[] getConstantPoolOffsets()
Answer the int array that corresponds to all the offsets of each entry in the constant pool

返回:
int[]

getEnclosingMethod

public char[] getEnclosingMethod()
从接口 IBinaryType 复制的描述
Answer the enclosing method (including method selector and method descriptor), or null if none. For example, "foo()Ljava/lang/Object;V"

指定者:
接口 IBinaryType 中的 getEnclosingMethod

getEnclosingTypeName

public char[] getEnclosingTypeName()
从接口 IBinaryType 复制的描述
Answer the resolved name of the enclosing type in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the receiver is a top level type. For example, java.lang.String is java/lang/String.

指定者:
接口 IBinaryType 中的 getEnclosingTypeName

getFields

public IBinaryField[] getFields()
Answer the receiver's this.fields or null if the array is empty.

指定者:
接口 IBinaryType 中的 getFields
返回:
org.eclipse.jdt.internal.compiler.api.IBinaryField[]

getFileName

public char[] getFileName()
从接口 IDependent 复制的描述
Answer the file name which defines the type. The path part (optional) must be separated from the actual file proper name by a separator suitable for the type (java.io.File.separator for example), e.g. "c:\\source\\com\\p\\X.java" or "/com/p/Y.java". The path to the zip or jar file (optional) must be separated from the actual path part by JAR_FILE_ENTRY_SEPARATOR, e.g. "c:\\lib\\some.jar|/com/p/X.class" or "/lib/some.zip|/com/q/Y.class". The proper file name includes the suffix extension (e.g. ".java") e.g. "c:/org/eclipse/jdt/internal/compileri/env/IDependent.java" Return null if no file defines the type.

指定者:
接口 IDependent 中的 getFileName
另请参见:
IDependent.getFileName()

getGenericSignature

public char[] getGenericSignature()
从接口 IBinaryType 复制的描述
Answer the receiver's signature which describes the parameter & return types as specified in section 4.4.4 of the Java 2 VM spec 3rd edition. Returns null if none.

指定者:
接口 IBinaryType 中的 getGenericSignature
返回:
the receiver's signature, null if none

getInnerSourceName

public char[] getInnerSourceName()
Answer the source name if the receiver is a inner type. Return null if it is an anonymous class or if the receiver is a top-level class. e.g. public class A { public class B { } public void foo() { class C {} } public Runnable bar() { return new Runnable() { public void run() {} }; } } It returns {'B'} for the member A$B It returns null for A It returns {'C'} for the local class A$1$C It returns null for the anonymous A$1

返回:
char[]

getInterfaceNames

public char[][] getInterfaceNames()
Answer the resolved names of the receiver's interfaces in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the array is empty. For example, java.lang.String is java/lang/String.

指定者:
接口 IBinaryType 中的 getInterfaceNames
返回:
char[][]

getMemberTypes

public IBinaryNestedType[] getMemberTypes()
Answer the receiver's nested types or null if the array is empty. This nested type info is extracted from the inner class attributes. Ask the name environment to find a member type using its compound name

指定者:
接口 IBinaryType 中的 getMemberTypes
返回:
org.eclipse.jdt.internal.compiler.api.IBinaryNestedType[]

getMethods

public IBinaryMethod[] getMethods()
Answer the receiver's this.methods or null if the array is empty.

指定者:
接口 IBinaryType 中的 getMethods
返回:
org.eclipse.jdt.internal.compiler.api.env.IBinaryMethod[]

getMissingTypeNames

public char[][][] getMissingTypeNames()
从接口 IBinaryType 复制的描述
Answer the list of missing type names which were referenced from the problem classfile. This list is encoded via an extra attribute.

指定者:
接口 IBinaryType 中的 getMissingTypeNames

getModifiers

public int getModifiers()
Answer an int whose bits are set according the access constants defined by the VM spec. Set the AccDeprecated and AccSynthetic bits if necessary

指定者:
接口 IGenericType 中的 getModifiers
返回:
int

getName

public char[] getName()
Answer the resolved name of the type in the class file format as specified in section 4.2 of the Java 2 VM spec. For example, java.lang.String is java/lang/String.

指定者:
接口 IBinaryType 中的 getName
返回:
char[]

getSourceName

public char[] getSourceName()
从接口 IBinaryType 复制的描述
Answer the simple name of the type in the class file. For member A$B, will answer B. For anonymous will answer null.

指定者:
接口 IBinaryType 中的 getSourceName

getSuperclassName

public char[] getSuperclassName()
Answer the resolved name of the receiver's superclass in the class file format as specified in section 4.2 of the Java 2 VM spec or null if it does not have one. For example, java.lang.String is java/lang/String.

指定者:
接口 IBinaryType 中的 getSuperclassName
返回:
char[]

getTagBits

public long getTagBits()
从接口 IBinaryType 复制的描述
Answer the tagbits set according to the bits for annotations.

指定者:
接口 IBinaryType 中的 getTagBits

getVersion

public long getVersion()
Answer the major/minor version defined in this class file according to the VM spec. as a long: (major<<16)+minor

返回:
the major/minor version found

hasStructuralChanges

public boolean hasStructuralChanges(byte[] newBytes)
Check if the receiver has structural changes compare to the byte array in argument. Structural changes are: - modifiers changes for the class, the this.fields or the this.methods - signature changes for this.fields or this.methods. - changes in the number of this.fields or this.methods - changes for field constants - changes for thrown exceptions - change for the super class or any super interfaces. - changes for member types name or modifiers If any of these changes occurs, the method returns true. false otherwise. The synthetic fields are included and the members are not required to be sorted.

参数:
newBytes - the bytes of the .class file we want to compare the receiver to
返回:
boolean Returns true is there is a structural change between the two .class files, false otherwise

hasStructuralChanges

public boolean hasStructuralChanges(byte[] newBytes,
                                    boolean orderRequired,
                                    boolean excludesSynthetic)
Check if the receiver has structural changes compare to the byte array in argument. Structural changes are: - modifiers changes for the class, the this.fields or the this.methods - signature changes for this.fields or this.methods. - changes in the number of this.fields or this.methods - changes for field constants - changes for thrown exceptions - change for the super class or any super interfaces. - changes for member types name or modifiers If any of these changes occurs, the method returns true. false otherwise.

参数:
newBytes - the bytes of the .class file we want to compare the receiver to
orderRequired - a boolean indicating whether the members should be sorted or not
excludesSynthetic - a boolean indicating whether the synthetic members should be used in the comparison
返回:
boolean Returns true is there is a structural change between the two .class files, false otherwise

isAnonymous

public boolean isAnonymous()
Answer true if the receiver is an anonymous type, false otherwise

指定者:
接口 IBinaryType 中的 isAnonymous
返回:
boolean

isBinaryType

public boolean isBinaryType()
Answer whether the receiver contains the resolved binary form or the unresolved source form of the type.

指定者:
接口 IGenericType 中的 isBinaryType
返回:
boolean

isLocal

public boolean isLocal()
Answer true if the receiver is a local type, false otherwise

指定者:
接口 IBinaryType 中的 isLocal
返回:
boolean

isMember

public boolean isMember()
Answer true if the receiver is a member type, false otherwise

指定者:
接口 IBinaryType 中的 isMember
返回:
boolean

isNestedType

public boolean isNestedType()
Answer true if the receiver is a nested type, false otherwise

返回:
boolean

sourceFileName

public char[] sourceFileName()
Answer the source file name attribute. Return null if there is no source file attribute for the receiver.

指定者:
接口 IBinaryType 中的 sourceFileName
返回:
char[]

toString

public String toString()
覆盖:
Object 中的 toString


Copyright © 2013. All Rights Reserved.