Class DynamicTable

All Implemented Interfaces:
Iterable<Entry>, Dumpable

public class DynamicTable extends Object implements Iterable<Entry>, Dumpable
  • Constructor Details

    • DynamicTable

      public DynamicTable()
  • Method Details

    • add

      public void add(Entry entry)
      Add an entry into the Dynamic Table. This will throw if it is not possible to insert this entry. Use canInsert(HttpField) to check whether it is possible to insert this entry.
      entry - the entry to insert.
    • canInsert

      public boolean canInsert(HttpField field)
      Is there enough room to insert a new entry into the Dynamic Table, possibly evicting unreferenced entries.
      field - the HttpField to insert into the table.
      if an entry with this HttpField can be inserted.
    • index

      public int index(Entry entry)
      Get the relative index of an entry in the Dynamic Table.
      entry - the entry to find the relative index of.
      the relative index of this entry.
    • getAbsolute

      public Entry getAbsolute(int absoluteIndex)
      Get an entry from the Dynamic table given an absolute index.
      absoluteIndex - the absolute index of the entry in the table.
      the entry with the absolute index.
    • get

      public Entry get(int index)
    • get

      public Entry get(String name)
    • get

      public Entry get(HttpField field)
    • getBase

      public int getBase()
    • getSize

      public int getSize()
    • getCapacity

      public int getCapacity()
    • getSpace

      public int getSpace()
    • getNumEntries

      public int getNumEntries()
    • getInsertCount

      public int getInsertCount()
    • setCapacity

      public void setCapacity(int capacity)
    • canReference

      public boolean canReference(Entry entry)
    • getDrainingIndex

      protected int getDrainingIndex()
      Entries with indexes lower than the draining index should not be referenced. This allows these entries to eventually be evicted as no more references will be made to them.
      the smallest absolute index that is allowed to be referenced.
    • iterator

      public Iterator<Entry> iterator()
      Specified by:
      iterator in interface Iterable<Entry>
    • dump

      public void dump(Appendable out, String indent) throws IOException
      Description copied from interface: Dumpable
      Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
      Specified by:
      dump in interface Dumpable
      out - The appendable to dump to
      indent - The indent to apply after any new lines.
      IOException - if unable to write to Appendable
    • toString

      public String toString()
      toString in class Object