Package jminusminus

Class CLConstantPool

java.lang.Object
jminusminus.CLConstantPool

class CLConstantPool extends Object
Representation of a class' constant pool.
  • Constructor Details

    • CLConstantPool

      public CLConstantPool()
      Constructs an empty constant pool.
  • Method Details

    • size

      public int size()
      Returns the size of the constant pool.
      Returns:
      the size of the constant pool.
    • find

      public int find(CLCPInfo cpInfo)
      Returns the index of the specified item in the constant pool or -1.
      Parameters:
      cpInfo - item to find.
      Returns:
      the index of the specified item in the constant pool or -1.
    • cpItem

      public CLCPInfo cpItem(int i)
      Returns the constant pool item at the specified index or null.
      Parameters:
      i - constant pool index.
      Returns:
      the constant pool item at the specified index or null.
    • addCPItem

      public int addCPItem(CLCPInfo cpInfo)
      Adds the specified (non-null) item to the constant pool and returns its index.
      Parameters:
      cpInfo - the item to add.
      Returns:
      constant pool index of the item.
    • write

      public void write(CLOutputStream out) throws IOException
      Writes the contents of the constant pool to the specified output stream.
      Parameters:
      out - output stream.
      Throws:
      IOException - if an error occurs while writing.
    • constantClassInfo

      public int constantClassInfo(String className)
      Returns the constant pool index of a singleton instance of CLConstantClassInfo.
      Parameters:
      className - class or interface name in internal form.
      Returns:
      constant pool index.
    • constantFieldRefInfo

      public int constantFieldRefInfo(String className, String name, String type)
      Returns the constant pool index of a singleton instance of CLConstantFieldRefInfo.
      Parameters:
      className - class or interface name in internal form.
      name - name of the field.
      type - descriptor of the field.
      Returns:
      constant pool index.
    • constantMethodRefInfo

      public int constantMethodRefInfo(String className, String name, String type)
      Returns the constant pool index of a singleton instance of CLConstantMethodRefInfo.
      Parameters:
      className - class or interface name in internal form.
      name - name of the method.
      type - descriptor of the method.
      Returns:
      constant pool index.
    • constantInterfaceMethodRefInfo

      public int constantInterfaceMethodRefInfo(String className, String name, String type)
      Returns the constant pool index of a singleton instance of CLConstantInterfaceMethodRefInfo.
      Parameters:
      className - class or interface name in internal form.
      name - name of the method.
      type - descriptor of the method.
      Returns:
      constant pool index.
    • constantStringInfo

      public int constantStringInfo(String s)
      Returns the constant pool index of a singleton instance of CLConstantStringInfo.
      Parameters:
      s - the constant string value.
      Returns:
      constant pool index.
    • constantIntegerInfo

      public int constantIntegerInfo(int i)
      Returns the constant pool index of a singleton instance of CLConstantIntegerInfo.
      Parameters:
      i - the constant int value.
      Returns:
      constant pool index.
    • constantFloatInfo

      public int constantFloatInfo(float f)
      Returns the constant pool index of a singleton instance of CLConstantFloatInfo.
      Parameters:
      f - the constant floating-point value.
      Returns:
      constant pool index.
    • constantLongInfo

      public int constantLongInfo(long l)
      Returns the constant pool index of a singleton instance of CLConstantLongInfo.
      Parameters:
      l - the constant long value.
      Returns:
      constant pool index.
    • constantDoubleInfo

      public int constantDoubleInfo(double d)
      Returns the constant pool index of a singleton instance of CLConstantDoubleInfo.
      Parameters:
      d - the constant double value.
      Returns:
      constant pool index.
    • constantNameAndTypeInfo

      public int constantNameAndTypeInfo(String name, String type)
      Returns the constant pool index of a singleton instance of CLConstantNameAndTypeInfo.
      Parameters:
      name - field or method name.
      type - field or method type descriptor.
      Returns:
      constant pool index.
    • constantUtf8Info

      public int constantUtf8Info(String s)
      Returns the constant pool index of a singleton instance of CLConstantUtf8Info.
      Parameters:
      s - the constant string value.
      Returns:
      constant pool index.