Class JdkClassReader

java.lang.Object
codes.rafael.asmjdkbridge.JdkClassReader

public class JdkClassReader extends Object
A reader for class files that uses the JDK class file API. The created class reader is immutable.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JdkClassReader(byte[] classFile, org.objectweb.asm.Attribute... attributePrototypes)
    Creates a new class reader.
    JdkClassReader(InputStream inputStream, org.objectweb.asm.Attribute... attributePrototypes)
    Creates a new class reader.
    JdkClassReader(String className, org.objectweb.asm.Attribute... attributePrototypes)
    Creates a new class reader.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(org.objectweb.asm.ClassVisitor classVisitor, int flags)
    Accepts a class visitor for the represented class file.
    int
    Returns the access flags of this class as stored in the class file.
    Returns the internal name of this class.
    Returns the internal interface names of this class.
    Returns the internal super class name of this class or null for Object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JdkClassReader

      public JdkClassReader(byte[] classFile, org.objectweb.asm.Attribute... attributePrototypes)
      Creates a new class reader.
      Parameters:
      classFile - The class file to represent.
      attributePrototypes - Prototypes of ASM attributes to map if discovered.
    • JdkClassReader

      public JdkClassReader(InputStream inputStream, org.objectweb.asm.Attribute... attributePrototypes) throws IOException
      Creates a new class reader.
      Parameters:
      inputStream - An input stream of the class file to represent.
      attributePrototypes - Prototypes of ASM attributes to map if discovered.
      Throws:
      IOException - If the stream cannot be read.
    • JdkClassReader

      public JdkClassReader(String className, org.objectweb.asm.Attribute... attributePrototypes) throws IOException
      Creates a new class reader.
      Parameters:
      className - The name of the class to represent. The class must be resolvable from the system loader.
      attributePrototypes - Prototypes of ASM attributes to map if discovered.
      Throws:
      IOException - If the class file cannot be read.
  • Method Details

    • getAccess

      public int getAccess()
      Returns the access flags of this class as stored in the class file.
      Returns:
      The access flags of this class as stored in the class file.
    • getClassName

      public String getClassName()
      Returns the internal name of this class.
      Returns:
      The internal name of this class.
    • getSuperName

      public String getSuperName()
      Returns the internal super class name of this class or null for Object.
      Returns:
      The internal super class name of this class or null for Object.
    • getInterfaces

      public String[] getInterfaces()
      Returns the internal interface names of this class. Maybe null.
      Returns:
      The internal interface names of this class.
    • accept

      public void accept(org.objectweb.asm.ClassVisitor classVisitor, int flags)
      Accepts a class visitor for the represented class file.
      Parameters:
      classVisitor - The class visitor to delegate calls to.
      flags - The ASM flags to consider when visiting the class file.