Class ConstantPool

java.lang.Object
org.eclipse.m2m.atl.emftvm.impl.resource.ConstantPool

public class ConstantPool extends Object
Constant pool implementation for binary EMFTVM file format.
  • Field Details

  • Constructor Details

    • ConstantPool

      public ConstantPool()
      Creates a new ConstantPool.
    • ConstantPool

      public ConstantPool(int size)
      Creates a new ConstantPool.
      Parameters:
      size - the initial pool size
  • Method Details

    • get

      public Object get(int i)
      Returns the constant at index
      i
      .
      Parameters:
      i - the constant index
      Returns:
      the constant, or null
    • indexOf

      public int indexOf(Object value) throws IllegalArgumentException
      Returns the index of
      value
      in the constant pool.
      Parameters:
      value - the value to look up
      Returns:
      the index of value in the constant pool
      Throws:
      IllegalArgumentException - if value not found
    • size

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

      public void add(Object value)
      Adds
      value
      to the constant pool, if necessary.
      Parameters:
      value - the value to add
    • read

      public void read(DataInputStream in) throws IOException
      Reads constant table from
      in
      .
      Parameters:
      in - the input stream
      Throws:
      IOException
    • createConstants

      public void createConstants(Module module)
      Creates a constant table for the given module.
      Parameters:
      module - the module
    • write

      public void write(DataOutputStream out) throws IOException
      Writes constant pool to
      out
      .
      Parameters:
      out - the output stream
      Throws:
      IOException