Class Entry

java.lang.Object
serp.bytecode.lowlevel.Entry
All Implemented Interfaces:
VisitAcceptor
Direct Known Subclasses:
ClassEntry, ComplexEntry, DoubleEntry, FloatEntry, IntEntry, InvokeDynamicEntry, LongEntry, MethodHandleEntry, MethodTypeEntry, NameAndTypeEntry, StringEntry, UTF8Entry

public abstract class Entry extends Object implements VisitAcceptor
Base type for all constant pool entries. Entries should generally be considered immutable; modifying an entry directly can have dire consequences, and often renders the resulting class file invalid.

Entries cannot be shared among constant pools.

Author:
Abe White
  • Field Details

  • Constructor Details

    • Entry

      public Entry()
  • Method Details

    • read

      public static Entry read(DataInput in) throws IOException
      Read a single entry from the given bytecode stream and returns it.
      Throws:
      IOException
    • write

      public static void write(Entry entry, DataOutput out) throws IOException
      Write the given entry to the given bytecode stream.
      Throws:
      IOException
    • create

      public static Entry create(int type)
      Create an entry based on its type code.
    • getType

      public abstract int getType()
      Return the type code for this entry type.
    • isWide

      public boolean isWide()
      Return true if this is a wide entry -- i.e. if it takes up two places in the constant pool. Returns false by default.
    • getPool

      public ConstantPool getPool()
      Returns the constant pool containing this entry, or null if none.
    • getIndex

      public int getIndex()
      Returns the index of the entry in the owning constant pool, or 0.