Class QpackEncoder

All Implemented Interfaces:

public class QpackEncoder extends Object implements Dumpable
  • Field Details

  • Constructor Details

  • Method Details

    • getMaxBlockedStreams

      public int getMaxBlockedStreams()
    • setMaxBlockedStreams

      public void setMaxBlockedStreams(int maxBlockedStreams)
    • getMaxHeadersSize

      public int getMaxHeadersSize()
    • setMaxHeadersSize

      public void setMaxHeadersSize(int maxHeadersSize)
    • getMaxTableCapacity

      public int getMaxTableCapacity()
    • setMaxTableCapacity

      public void setMaxTableCapacity(int maxTableCapacity)
    • getTableCapacity

      public int getTableCapacity()
    • setTableCapacity

      public void setTableCapacity(int capacity)
      Set the capacity of the DynamicTable and send a instruction to set the capacity on the remote Decoder.
      capacity - the new capacity.
    • encode

      public void encode(ByteBuffer buffer, long streamId, MetaData metadata) throws QpackException

      Encodes a MetaData object into the supplied ByteBuffer for a specific HTTP/s stream.

      This method may generate instructions to be sent back over the Encoder stream to the remote Decoder.

      The given buffer is filled starting from its current position p with N encoded bytes and upon return its position will be p + N.

      buffer - the buffer to take the bytes of the encoded MetaData.
      streamId - the stream ID corresponding to this headers frame.
      metadata - the MetaData to encode into the buffer.
      QpackException - if there was an error with the QPACK compression.
    • parseInstructions

      public void parseInstructions(ByteBuffer buffer) throws QpackException
      Parse instructions from the Decoder stream. The Decoder stream carries an unframed sequence of instructions from the Decoder to the Encoder. This method will fully consume the supplied ByteBuffer and produce instructions to update the state of the Encoder and its Dynamic Table.
      buffer - a buffer containing bytes from the Decoder stream.
      QpackException - if there was an error parsing or handling the instructions.
    • insert

      public boolean insert(HttpField field)
      A speculative insert of a Header into the Encoders Dynamic Table. This will also generate an instruction to be sent over the Encoder stream to the remote Decoder.
      field - the field to insert into the Dynamic Table.
      true if the field was successfully inserted into the Dynamic Table.
    • streamCancellation

      public void streamCancellation(long streamId)
      Tells the QpackEncoder that a particular stream has been cancelled. Any state stored for this stream will be discarded. The encoder may also receive a stream cancellation instruction from the remote Decoder to cancel the stream which will be a noop if this method was called on the local encoder first.
      streamId - the streamId of the stream that was cancelled.
    • shouldIndex

      protected boolean shouldIndex(HttpField httpField)
    • shouldHuffmanEncode

      protected boolean shouldHuffmanEncode(HttpField httpField)
    • 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