| java.lang.Object | |
| ↳ | org.eclipse.sisu.space.asm.ClassReader |
A Java class parser to make a ClassVisitor visit an existing class.
This class parses a byte array conforming to the Java class file format and
calls the appropriate visit methods of a given class visitor for each field,
method and bytecode instruction encountered.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | EXPAND_FRAMES | Flag to expand the stack map frames. | |||||||||
| int | SKIP_CODE | Flag to skip method code. | |||||||||
| int | SKIP_DEBUG | Flag to skip the debug information in the class. | |||||||||
| int | SKIP_FRAMES | Flag to skip the stack map frames in the class. | |||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| b | The class to be parsed. | ||||||||||
| header | Start index of the class header information (access, name...) in
b. |
||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
ClassReader object. | |||||||||||
Constructs a new
ClassReader object. | |||||||||||
Constructs a new
ClassReader object. | |||||||||||
Constructs a new
ClassReader object. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Makes the given visitor visit the Java class of this
ClassReader. | |||||||||||
Makes the given visitor visit the Java class of this
ClassReader
. | |||||||||||
Returns the class's access flags (see
Opcodes). | |||||||||||
Returns the internal name of the class (see
getInternalName). | |||||||||||
Returns the internal names of the class's interfaces (see
getInternalName). | |||||||||||
Returns the start index of the constant pool item in
b, plus
one. | |||||||||||
Returns the number of constant pool items in
b. | |||||||||||
Returns the maximum length of the strings contained in the constant pool
of the class.
| |||||||||||
Returns the internal of name of the super class (see
getInternalName). | |||||||||||
Reads a byte value in
b. | |||||||||||
Reads a class constant pool item in
b. | |||||||||||
Reads a numeric or string constant pool item in
b. | |||||||||||
Reads a signed int value in
b. | |||||||||||
Reads a signed long value in
b. | |||||||||||
Reads a signed short value in
b. | |||||||||||
Reads an UTF8 string constant pool item in
b. | |||||||||||
Reads an unsigned short value in
b. | |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the label corresponding to the given offset.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Flag to expand the stack map frames. By default stack map frames are visited in their original format (i.e. "expanded" for classes whose version is less than V1_6, and "compressed" for the other classes). If this flag is set, stack map frames are always visited in expanded format (this option adds a decompression/recompression step in ClassReader and ClassWriter which degrades performances quite a lot).
Flag to skip method code. If this class is set CODE
attribute won't be visited. This can be used, for example, to retrieve
annotations for methods and method parameters.
Flag to skip the debug information in the class. If this flag is set the
debug information of the class is not visited, i.e. the
visitLocalVariable and
visitLineNumber methods will not be
called.
Flag to skip the stack map frames in the class. If this flag is set the
stack map frames of the class is not visited, i.e. the
visitFrame method will not be called.
This flag is useful when the COMPUTE_FRAMES option is
used: it avoids visiting frames that will be ignored and recomputed from
scratch in the class writer.
The class to be parsed. The content of this array must not be
modified. This field is intended for Attribute sub classes, and
is normally not needed by class generators or adapters.
Constructs a new ClassReader object.
| b | the bytecode of the class to be read. |
|---|
Constructs a new ClassReader object.
| b | the bytecode of the class to be read. |
|---|---|
| off | the start offset of the class data. |
| len | the length of the class data. |
Constructs a new ClassReader object.
| is | an input stream from which to read the class. |
|---|
| IOException | if a problem occurs during reading. |
|---|
Constructs a new ClassReader object.
| name | the binary qualified name of the class to be read. |
|---|
| IOException | if an exception occurs during reading. |
|---|
Makes the given visitor visit the Java class of this ClassReader.
This class is the one specified in the constructor (see
ClassReader).
| 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 SKIP_DEBUG, EXPAND_FRAMES
, SKIP_FRAMES, SKIP_CODE.
|
Makes the given visitor visit the Java class of this ClassReader
. This class is the one specified in the constructor (see
ClassReader).
| classVisitor | the visitor that must visit this class. |
|---|---|
| flags | option flags that can be used to modify the default behavior
of this class. See SKIP_DEBUG, EXPAND_FRAMES
, SKIP_FRAMES, SKIP_CODE.
|
Returns the class's access flags (see Opcodes). This value may
not reflect Deprecated and Synthetic flags when bytecode is before 1.5
and those flags are represented by attributes.
Returns the internal name of the class (see
getInternalName).
Returns the internal names of the class's interfaces (see
getInternalName).
Returns the maximum length of the strings contained in the constant pool of the class.
Returns the internal of name of the super class (see
getInternalName). For interfaces, the
super class is Object.
Object class.Reads a class constant pool item in b. This method is
intended for Attribute sub classes, and is normally not needed by
class generators or adapters.
| index | the start index of an unsigned short value in 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. |
Reads a numeric or string constant pool item in b. This
method is intended for Attribute sub classes, and is normally not
needed by class generators or adapters.
| 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. |
Reads an UTF8 string constant pool item in b. This method
is intended for Attribute sub classes, and is normally not needed
by class generators or adapters.
| index | the start index of an unsigned short value in 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 label corresponding to the given offset. The default implementation of this method creates a label for the given offset if it has not been already created.
| 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. |