public class ClassReader extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
byte[] |
b
已过时。
Use
readByte(int) and the other read methods instead. This field will
eventually be deleted. |
static int |
EXPAND_FRAMES
A flag to expand the stack map frames.
|
int |
header
The offset in bytes of the ClassFile's access_flags field.
|
static int |
SKIP_CODE
A flag to skip the Code attributes.
|
static int |
SKIP_DEBUG
A flag to skip the SourceFile.
|
static int |
SKIP_FRAMES
A flag to skip the StackMap and StackMapTable attributes.
|
static int |
V19 |
| 构造器和说明 |
|---|
ClassReader(byte[] classFile)
Constructs a new
ClassReader object. |
ClassReader(byte[] classFileBuffer,
int classFileOffset,
int classFileLength)
Constructs a new
ClassReader object. |
ClassReader(InputStream inputStream)
Constructs a new
ClassReader object. |
ClassReader(String className)
Constructs a new
ClassReader object. |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
getAccess()
Returns the class's access flags .
|
String |
getClassName()
the internal class name.
|
String[] |
getInterfaces()
the internal names of the directly implemented interfaces.
|
int |
getItem(int constantPoolEntryIndex)
Returns the start offset in this
ClassReader of a JVMS 'cp_info' structure (i.e. a
constant pool entry), plus one. |
int |
getItemCount()
Returns the number of entries in the class's constant pool table.
|
int |
getMaxStringLength()
Returns a conservative estimate of the maximum length of the strings contained in the class's
constant pool table.
|
String |
getSuperName() |
int |
readByte(int offset)
Reads a byte value in this
ClassReader. |
String |
readClass(int offset,
char[] charBuffer)
Reads a CONSTANT_Class constant pool entry in this
ClassReader. |
int |
readInt(int offset)
Reads a signed int value in this
ClassReader. |
long |
readLong(int offset)
Reads a signed long value in this
ClassReader. |
String |
readModule(int offset,
char[] charBuffer)
Reads a CONSTANT_Module constant pool entry in this
ClassReader. |
String |
readPackage(int offset,
char[] charBuffer)
Reads a CONSTANT_Package constant pool entry in this
ClassReader. |
short |
readShort(int offset)
Reads a signed short value in this
ClassReader. |
int |
readUnsignedShort(int offset)
Reads an unsigned short value in this
ClassReader. |
String |
readUtf8(int offset,
char[] charBuffer)
Reads a CONSTANT_Utf8 constant pool entry in this
ClassReader. |
public static final int SKIP_CODE
public static final int V19
public static final int SKIP_DEBUG
public static final int SKIP_FRAMES
public static final int EXPAND_FRAMES
@Deprecated public final byte[] b
readByte(int) and the other read methods instead. This field will
eventually be deleted.public final int header
public ClassReader(byte[] classFile)
ClassReader object.classFile - the JVMS ClassFile structure to be read.public ClassReader(byte[] classFileBuffer,
int classFileOffset,
int classFileLength)
ClassReader object.classFileBuffer - a byte array containing the JVMS ClassFile structure to be read.classFileOffset - the offset in byteBuffer of the first byte of the ClassFile to be read.classFileLength - the length in bytes of the ClassFile to be read.public ClassReader(InputStream inputStream) throws IOException
ClassReader object.inputStream - an input stream of the JVMS ClassFile structure to be read. This input
stream must contain nothing more than the ClassFile structure itself. It is read from its
current position to its end.IOException - if a problem occurs during reading.public ClassReader(String className) throws IOException
ClassReader object.className - the fully qualified name of the class to be read. The ClassFile structure is
retrieved with the current class loader's ClassLoader.getSystemResourceAsStream(java.lang.String).IOException - if an exception occurs during reading.public int getAccess()
public String getClassName()
public String getSuperName()
public String[] getInterfaces()
public int getItemCount()
public int getItem(int constantPoolEntryIndex)
ClassReader of a JVMS 'cp_info' structure (i.e. a
constant pool entry), plus one. This method is intended for Attribute sub classes,
and is normally not needed by class generators or adapters.constantPoolEntryIndex - the index a constant pool entry in the class's constant pool
table.ClassReader of the corresponding JVMS 'cp_info'
structure, plus one.public int getMaxStringLength()
public int readByte(int offset)
ClassReader. This method is intended for
Attribute sub classes, and is normally not needed by class generators or adapters.offset - the start offset of the value to be read in this ClassReader.public int readUnsignedShort(int offset)
ClassReader. This method is intended for
Attribute sub classes, and is normally not needed by class generators or adapters.offset - the start index of the value to be read in this ClassReader.public short readShort(int offset)
ClassReader. This method is intended for
Attribute sub classes, and is normally not needed by class generators or adapters.offset - the start offset of the value to be read in this ClassReader.public int readInt(int offset)
ClassReader. This method is intended for
Attribute sub classes, and is normally not needed by class generators or adapters.offset - the start offset of the value to be read in this ClassReader.public long readLong(int offset)
ClassReader. This method is intended for
Attribute sub classes, and is normally not needed by class generators or adapters.offset - the start offset of the value to be read in this ClassReader.public String readUtf8(int offset, char[] charBuffer)
ClassReader. This method is
intended for Attribute sub classes, and is normally not needed by class generators or
adapters.offset - the start offset of an unsigned short value in this ClassReader, whose
value is the index of a CONSTANT_Utf8 entry in the class's constant pool table.charBuffer - the buffer to be used to read the string. This buffer must be sufficiently
large. It is not automatically resized.public String readClass(int offset, char[] charBuffer)
ClassReader. This method is
intended for Attribute sub classes, and is normally not needed by class generators or
adapters.offset - the start offset of an unsigned short value in this ClassReader, whose
value is the index of a CONSTANT_Class entry in class's constant pool table.charBuffer - the buffer to be used to read the item. This buffer must be sufficiently
large. It is not automatically resized.public String readModule(int offset, char[] charBuffer)
ClassReader. This method is
intended for Attribute sub classes, and is normally not needed by class generators or
adapters.offset - the start offset of an unsigned short value in this ClassReader, whose
value is the index of a CONSTANT_Module entry in class's constant pool table.charBuffer - the buffer to be used to read the item. This buffer must be sufficiently
large. It is not automatically resized.public String readPackage(int offset, char[] charBuffer)
ClassReader. This method is
intended for Attribute sub classes, and is normally not needed by class generators or
adapters.offset - the start offset of an unsigned short value in this ClassReader, whose
value is the index of a CONSTANT_Package entry in class's constant pool table.charBuffer - the buffer to be used to read the item. This buffer must be sufficiently
large. It is not automatically resized.Copyright © 2018–2024 Alibaba Group. All rights reserved.