Class ClassFileWriter.ConstPoolWriter

  • Enclosing class:
    ClassFileWriter

    public static final class ClassFileWriter.ConstPoolWriter
    extends java.lang.Object
    Constant Pool.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int addClassInfo​(int name)
      Adds a new CONSTANT_Class_info structure.
      int addClassInfo​(java.lang.String jvmname)
      Adds a new CONSTANT_Class_info structure.
      int[] addClassInfo​(java.lang.String[] classNames)
      Makes CONSTANT_Class_info objects for each class name.
      int addDoubleInfo​(double d)
      Adds a new CONSTANT_Double_info structure.
      int addDynamicInfo​(int bootstrap, int nameAndTypeInfo)
      Adds a new CONSTANT_Dynamic_info structure.
      int addFieldrefInfo​(int classInfo, int nameAndTypeInfo)
      Adds a new CONSTANT_Fieldref_info structure.
      int addFloatInfo​(float f)
      Adds a new CONSTANT_Float_info structure.
      int addIntegerInfo​(int i)
      Adds a new CONSTANT_Integer_info structure.
      int addInterfaceMethodrefInfo​(int classInfo, int nameAndTypeInfo)
      Adds a new CONSTANT_InterfaceMethodref_info structure.
      int addInvokeDynamicInfo​(int bootstrap, int nameAndTypeInfo)
      Adds a new CONSTANT_InvokeDynamic_info structure.
      int addLongInfo​(long l)
      Adds a new CONSTANT_Long_info structure.
      int addMethodHandleInfo​(int kind, int index)
      Adds a new CONSTANT_MethodHandle_info structure.
      int addMethodrefInfo​(int classInfo, int nameAndTypeInfo)
      Adds a new CONSTANT_Methodref_info structure.
      int addMethodTypeInfo​(int desc)
      Adds a new CONSTANT_MethodType_info structure.
      int addNameAndTypeInfo​(int name, int type)
      Adds a new CONSTANT_NameAndType_info structure.
      int addNameAndTypeInfo​(java.lang.String name, java.lang.String type)
      Adds a new CONSTANT_NameAndType_info structure.
      int addStringInfo​(java.lang.String str)
      Adds a new CONSTANT_String_info structure.
      int addUtf8Info​(java.lang.String utf8)
      Adds a new CONSTANT_Utf8_info structure.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addClassInfo

        public int[] addClassInfo​(java.lang.String[] classNames)
        Makes CONSTANT_Class_info objects for each class name.
        Returns:
        an array of indexes indicating CONSTANT_Class_infos.
      • addClassInfo

        public int addClassInfo​(java.lang.String jvmname)
        Adds a new CONSTANT_Class_info structure.

        This also adds a CONSTANT_Utf8_info structure for storing the class name.

        Parameters:
        jvmname - the JVM-internal representation of a class name. e.g. java/lang/Object.
        Returns:
        the index of the added entry.
      • addClassInfo

        public int addClassInfo​(int name)
        Adds a new CONSTANT_Class_info structure.
        Parameters:
        name - name_index
        Returns:
        the index of the added entry.
      • addNameAndTypeInfo

        public int addNameAndTypeInfo​(java.lang.String name,
                                      java.lang.String type)
        Adds a new CONSTANT_NameAndType_info structure.
        Parameters:
        name - name_index
        type - descriptor_index
        Returns:
        the index of the added entry.
      • addNameAndTypeInfo

        public int addNameAndTypeInfo​(int name,
                                      int type)
        Adds a new CONSTANT_NameAndType_info structure.
        Parameters:
        name - name_index
        type - descriptor_index
        Returns:
        the index of the added entry.
      • addFieldrefInfo

        public int addFieldrefInfo​(int classInfo,
                                   int nameAndTypeInfo)
        Adds a new CONSTANT_Fieldref_info structure.
        Parameters:
        classInfo - class_index
        nameAndTypeInfo - name_and_type_index.
        Returns:
        the index of the added entry.
      • addMethodrefInfo

        public int addMethodrefInfo​(int classInfo,
                                    int nameAndTypeInfo)
        Adds a new CONSTANT_Methodref_info structure.
        Parameters:
        classInfo - class_index
        nameAndTypeInfo - name_and_type_index.
        Returns:
        the index of the added entry.
      • addInterfaceMethodrefInfo

        public int addInterfaceMethodrefInfo​(int classInfo,
                                             int nameAndTypeInfo)
        Adds a new CONSTANT_InterfaceMethodref_info structure.
        Parameters:
        classInfo - class_index
        nameAndTypeInfo - name_and_type_index.
        Returns:
        the index of the added entry.
      • addMethodHandleInfo

        public int addMethodHandleInfo​(int kind,
                                       int index)
        Adds a new CONSTANT_MethodHandle_info structure.
        Parameters:
        kind - reference_kind such as REF_invokeStatic.
        index - reference_index.
        Returns:
        the index of the added entry.
        Since:
        3.17.1
      • addMethodTypeInfo

        public int addMethodTypeInfo​(int desc)
        Adds a new CONSTANT_MethodType_info structure.
        Parameters:
        desc - descriptor_index.
        Returns:
        the index of the added entry.
        Since:
        3.17.1
      • addInvokeDynamicInfo

        public int addInvokeDynamicInfo​(int bootstrap,
                                        int nameAndTypeInfo)
        Adds a new CONSTANT_InvokeDynamic_info structure.
        Parameters:
        bootstrap - bootstrap_method_attr_index.
        nameAndTypeInfo - name_and_type_index.
        Returns:
        the index of the added entry.
        Since:
        3.17.1
      • addDynamicInfo

        public int addDynamicInfo​(int bootstrap,
                                  int nameAndTypeInfo)
        Adds a new CONSTANT_Dynamic_info structure.
        Parameters:
        bootstrap - bootstrap_method_attr_index.
        nameAndTypeInfo - name_and_type_index.
        Returns:
        the index of the added entry.
        Since:
        3.26
      • addStringInfo

        public int addStringInfo​(java.lang.String str)
        Adds a new CONSTANT_String_info structure.

        This also adds a new CONSTANT_Utf8_info structure.

        Returns:
        the index of the added entry.
      • addIntegerInfo

        public int addIntegerInfo​(int i)
        Adds a new CONSTANT_Integer_info structure.
        Returns:
        the index of the added entry.
      • addFloatInfo

        public int addFloatInfo​(float f)
        Adds a new CONSTANT_Float_info structure.
        Returns:
        the index of the added entry.
      • addLongInfo

        public int addLongInfo​(long l)
        Adds a new CONSTANT_Long_info structure.
        Returns:
        the index of the added entry.
      • addDoubleInfo

        public int addDoubleInfo​(double d)
        Adds a new CONSTANT_Double_info structure.
        Returns:
        the index of the added entry.
      • addUtf8Info

        public int addUtf8Info​(java.lang.String utf8)
        Adds a new CONSTANT_Utf8_info structure.
        Returns:
        the index of the added entry.