Class BinaryConstantPool

  • All Implemented Interfaces:
    Constants, RuntimeConstants

    public final class BinaryConstantPool
    extends java.lang.Object
    implements Constants
    This class is used to represent a constant table once it is read from a class file. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Field Detail

      • types

        private byte[] types
      • cpool

        private java.lang.Object[] cpool
      • indexHashObject

        java.util.Hashtable<java.lang.Object,​java.lang.Integer> indexHashObject
      • indexHashAscii

        java.util.Hashtable<java.lang.Object,​java.lang.Integer> indexHashAscii
      • MoreStuff

        java.util.Vector<java.lang.String> MoreStuff
    • Constructor Detail

      • BinaryConstantPool

        BinaryConstantPool​(java.io.DataInputStream in)
                    throws java.io.IOException
        Constructor
        Throws:
        java.io.IOException
    • Method Detail

      • readBytes

        private byte[] readBytes​(java.io.DataInputStream in,
                                 int cnt)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getInteger

        public int getInteger​(int n)
        get a integer
      • getValue

        public java.lang.Object getValue​(int n)
        get a value
      • getString

        public java.lang.String getString​(int n)
        get a string
      • getIdentifier

        public Identifier getIdentifier​(int n)
        get an identifier
      • getType

        public Type getType​(int n)
        get a type from a type signature
      • getConstantType

        public int getConstantType​(int n)
        get the type of constant given an index
      • getConstant

        public java.lang.Object getConstant​(int n,
                                            Environment env)
        get the n-th constant from the constant pool
      • getDependencies

        public java.util.Vector<ClassDeclaration> getDependencies​(Environment env)
        Get a list of dependencies, ie: all the classes referenced in this constant pool.
      • indexObject

        public int indexObject​(java.lang.Object obj,
                               Environment env)
        Find the index of an Object in the constant pool
      • indexString

        public int indexString​(java.lang.String string,
                               Environment env)
        Find the index of an ascii string in the constant pool. If it's not in the constant pool, then add it at the end.
      • createIndexHash

        public void createIndexHash​(Environment env)
        Create a hash table of all the items in the constant pool that could possibly be referenced from the outside.
      • write

        public void write​(java.io.DataOutputStream out,
                          Environment env)
                   throws java.io.IOException
        Write out the contents of the constant pool, including any additions that have been added.
        Throws:
        java.io.IOException