org.objectweb.asm
public class ClassReader extends Object
Field Summary | |
---|---|
byte[] | b
The class to be parsed. |
static int | EXPAND_FRAMES
Flag to expand the stack map frames. |
int | header
Start index of the class header information (access, name...) in
{@link #b b}. |
static int | SKIP_CODE
Flag to skip method code. |
static int | SKIP_DEBUG
Flag to skip the debug information in the class. |
static int | SKIP_FRAMES
Flag to skip the stack map frames in the class. |
Constructor Summary | |
---|---|
ClassReader(byte[] b)
Constructs a new {@link ClassReader} object.
| |
ClassReader(byte[] b, int off, int len)
Constructs a new {@link ClassReader} object.
| |
ClassReader(InputStream is)
Constructs a new {@link ClassReader} object.
| |
ClassReader(String name)
Constructs a new {@link ClassReader} object.
|
Method Summary | |
---|---|
void | accept(ClassVisitor classVisitor, int flags)
Makes the given visitor visit the Java class of this {@link ClassReader}.
|
void | accept(ClassVisitor classVisitor, Attribute[] attrs, int flags)
Makes the given visitor visit the Java class of this {@link ClassReader}.
|
int | getAccess()
Returns the class's access flags (see {@link Opcodes}). |
String | getClassName()
Returns the internal name of the class (see
{@link Type#getInternalName() getInternalName}).
|
String[] | getInterfaces()
Returns the internal names of the class's interfaces (see
{@link Type#getInternalName() getInternalName}).
|
int | getItem(int item)
Returns the start index of the constant pool item in {@link #b b}, plus
one. |
String | getSuperName()
Returns the internal of name of the super class (see
{@link Type#getInternalName() getInternalName}). |
int | readByte(int index)
Reads a byte value in {@link #b b}. |
String | readClass(int index, char[] buf)
Reads a class constant pool item in {@link #b b}. |
Object | readConst(int item, char[] buf)
Reads a numeric or string constant pool item in {@link #b b}. |
int | readInt(int index)
Reads a signed int value in {@link #b b}. |
protected Label | readLabel(int offset, Label[] labels)
Returns the label corresponding to the given offset. |
long | readLong(int index)
Reads a signed long value in {@link #b b}. |
short | readShort(int index)
Reads a signed short value in {@link #b b}. |
int | readUnsignedShort(int index)
Reads an unsigned short value in {@link #b b}. |
String | readUTF8(int index, char[] buf)
Reads an UTF8 string constant pool item in {@link #b b}. |
CODE
attribute won't be visited. This can be used, for example, to retrieve
annotations for methods and method parameters.Parameters: b the bytecode of the class to be read.
Parameters: b the bytecode of the class to be read. off the start offset of the class data. len the length of the class data.
Parameters: is an input stream from which to read the class.
Throws: IOException if a problem occurs during reading.
Parameters: name the fully qualified name of the class to be read.
Throws: IOException if an exception occurs during reading.
Parameters: classVisitor the visitor that must visit this class. flags option flags that can be used to modify the default behavior of this class. See {@link #SKIP_DEBUG}, {@link #EXPAND_FRAMES}, {@link #SKIP_FRAMES}, {@link #SKIP_CODE}.
Parameters: classVisitor the visitor that must visit this class. attrs prototypes of the attributes that must be parsed during the visit of the class. Any attribute whose type is not equal to the type of one the prototypes will not be parsed: its byte array value will be passed unchanged to the ClassWriter. This may corrupt it if this value contains references to the constant pool, or has syntactic or semantic links with a class element that has been transformed by a class adapter between the reader and the writer. flags option flags that can be used to modify the default behavior of this class. See {@link #SKIP_DEBUG}, {@link #EXPAND_FRAMES}, {@link #SKIP_FRAMES}, {@link #SKIP_CODE}.
Returns: the class access flags
Returns: the internal class name
Returns: the array of internal names for all implemented interfaces or null.
Parameters: item the index a constant pool item.
Returns: the start index of the constant pool item in {@link #b b}, plus one.
Returns: the internal name of super class, or null for {@link Object} class.
Parameters: index the start index of the value to be read in {@link #b b}.
Returns: the read value.
Parameters: index the start index of an unsigned short value in {@link #b b}, whose value is the index of a class constant pool item. buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized.
Returns: the String corresponding to the specified class item.
Parameters: item the index of a constant pool item. buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized.
Returns: the {@link Integer}, {@link Float}, {@link Long}, {@link Double}, {@link String} or {@link Type} corresponding to the given constant pool item.
Parameters: index the start index of the value to be read in {@link #b b}.
Returns: the read value.
Parameters: offset a bytecode offset in a method. labels the already created labels, indexed by their offset. If a label already exists for offset this method must not create a new one. Otherwise it must store the new label in this array.
Returns: a non null Label, which must be equal to labels[offset].
Parameters: index the start index of the value to be read in {@link #b b}.
Returns: the read value.
Parameters: index the start index of the value to be read in {@link #b b}.
Returns: the read value.
Parameters: index the start index of the value to be read in {@link #b b}.
Returns: the read value.
Parameters: index the start index of an unsigned short value in {@link #b b}, whose value is the index of an UTF8 constant pool item. buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized.
Returns: the String corresponding to the specified UTF8 item.