Save This Page
Home » asm-3.1 » org.objectweb » asm » [javadoc | source]
org.objectweb.asm
public class: ClassReader [javadoc | source]
java.lang.Object
   org.objectweb.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.
Field Summary
static final  boolean SIGNATURES    True to enable signatures support. 
static final  boolean ANNOTATIONS    True to enable annotations support. 
static final  boolean FRAMES    True to enable stack map frames support. 
static final  boolean WRITER    True to enable bytecode writing support. 
static final  boolean RESIZE    True to enable JSR_W and GOTO_W support. 
public static final  int SKIP_CODE    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. 
public static final  int SKIP_DEBUG    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. 
public static final  int SKIP_FRAMES    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 ClassWriter#COMPUTE_FRAMES option is used: it avoids visiting frames that will be ignored and recomputed from scratch in the class writer. 
public static final  int EXPAND_FRAMES    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). 
public final  byte[] b    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. 
public final  int header    Start index of the class header information (access, name...) in b
Constructor:
 public ClassReader(byte[] b) 
    Parameters:
    b - the bytecode of the class to be read.
 public ClassReader(InputStream is) throws IOException 
    Parameters:
    is - an input stream from which to read the class.
    Throws:
    IOException - if a problem occurs during reading.
 public ClassReader(String name) throws IOException 
    Parameters:
    name - the fully qualified name of the class to be read.
    Throws:
    IOException - if an exception occurs during reading.
 public ClassReader(byte[] b,
    int off,
    int len) 
    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.
Method from org.objectweb.asm.ClassReader Summary:
accept,   accept,   copyPool,   getAccess,   getClassName,   getInterfaces,   getItem,   getSuperName,   readByte,   readClass,   readConst,   readInt,   readLabel,   readLong,   readShort,   readUTF8,   readUnsignedShort
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.objectweb.asm.ClassReader Detail:
 public  void accept(ClassVisitor classVisitor,
    int flags) 
    Makes the given visitor visit the Java class of this ClassReader . This class is the one specified in the constructor (see ClassReader ).
 public  void accept(ClassVisitor classVisitor,
    Attribute[] attrs,
    int flags) 
    Makes the given visitor visit the Java class of this ClassReader . This class is the one specified in the constructor (see ClassReader ).
  void copyPool(ClassWriter classWriter) 
 public int getAccess() 
    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.
 public String getClassName() 
 public String[] getInterfaces() 
    Returns the internal names of the class's interfaces (see getInternalName ).
 public int getItem(int item) 
    Returns the start index of the constant pool item in b , plus one. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.
 public String getSuperName() 
    Returns the internal of name of the super class (see getInternalName ). For interfaces, the super class is Object .
 public int readByte(int index) 
    Reads a byte value in b . This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.
 public String readClass(int index,
    char[] buf) 
    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.
 public Object readConst(int item,
    char[] buf) 
    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.
 public int readInt(int index) 
    Reads a signed int value in b . This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.
 protected Label readLabel(int offset,
    Label[] labels) 
    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.
 public long readLong(int index) 
    Reads a signed long value in b . This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.
 public short readShort(int index) 
    Reads a signed short value in b . This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.
 public String readUTF8(int index,
    char[] buf) 
    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.
 public int readUnsignedShort(int index) 
    Reads an unsigned short value in b . This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters.