Top Inners Fields Constructors Methods
org.eclipse.jetty.http3.qpack

public Class QpackEncoder

extends Object
implements Dumpable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.component.Dumpable
Imports
java.io.IOException, java.nio.BufferOverflowException, .ByteBuffer, java.util.ArrayList, .EnumSet, .HashMap, .List, .Map, org.eclipse.jetty.http.HttpField, .HttpHeader, .MetaData, .PreEncodedHttpField, org.eclipse.jetty.http.compression.NBitIntegerEncoder, org.eclipse.jetty.http3.qpack.internal.EncodableEntry, .QpackContext, .StreamInfo, org.eclipse.jetty.http3.qpack.internal.instruction.DuplicateInstruction, .IndexedNameEntryInstruction, .LiteralNameEntryInstruction, .SetCapacityInstruction, org.eclipse.jetty.http3.qpack.internal.metadata.Http3Fields, org.eclipse.jetty.http3.qpack.internal.parser.EncoderInstructionParser, org.eclipse.jetty.http3.qpack.internal.table.DynamicTable, .Entry, org.eclipse.jetty.util.BufferUtil, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.thread.AutoLock, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private int
private final QpackContext
private final Instruction.Handler
private final QpackEncoder.InstructionHandler
private final List<Instruction>
private int
private int
private int
private int
private final EncoderInstructionParser
private final Map<Long, StreamInfo>
public static final EnumSet<HttpHeader>
public static final EnumSet<HttpHeader>
private final AutoLock
private static final Logger
public static final EnumSet<HttpHeader>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
dump(Appendable out, String indent)

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines.

public void
encode(ByteBuffer
the buffer to take the bytes of the encoded MetaData.
buffer
,
long
the stream ID corresponding to this headers frame.
streamId
,
MetaData
the MetaData to encode into the buffer.
metadata
)

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

private EncodableEntry
encode(StreamInfo streamInfo, HttpField field)

private static int
encodeInsertCount(int reqInsertCount, int maxTableCapacity)

pack-priv QpackEncoder.InstructionHandler
public int
public int
public int
pack-priv Map<Long, StreamInfo>
public int
public boolean

Returns:

true if the field was successfully inserted into the Dynamic Table.
insert
(HttpField
the field to insert into the Dynamic Table.
field
)

A speculative insert of a Header into the Encoders Dynamic Table.

private void
public void
parseInstructions(ByteBuffer
a buffer containing bytes from the Decoder stream.
buffer
)

Parse instructions from the Decoder stream.

private boolean
referenceEntry(Entry entry, StreamInfo streamInfo)

public void
setMaxBlockedStreams(int maxBlockedStreams)

public void
setMaxHeadersSize(int maxHeadersSize)

public void
setMaxTableCapacity(int maxTableCapacity)

public void
setTableCapacity(int
the new capacity.
capacity
)

Set the capacity of the DynamicTable and send a instruction to set the capacity on the remote Decoder.

protected boolean
protected boolean
public void
streamCancellation(long
the streamId of the stream that was cancelled.
streamId
)

Tells the QpackEncoder that a particular stream has been cancelled.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_blockedStreamsback to summary
private int _blockedStreams
_contextback to summary
private final QpackContext _context
_handlerback to summary
private final Instruction.Handler _handler
_instructionHandlerback to summary
private final QpackEncoder.InstructionHandler _instructionHandler
_instructionsback to summary
private final List<Instruction> _instructions
_knownInsertCountback to summary
private int _knownInsertCount
_maxBlockedStreamsback to summary
private int _maxBlockedStreams
_maxHeadersSizeback to summary
private int _maxHeadersSize
_maxTableCapacityback to summary
private int _maxTableCapacity
_parserback to summary
private final EncoderInstructionParser _parser
_streamInfoMapback to summary
private final Map<Long, StreamInfo> _streamInfoMap
DO_NOT_HUFFMANback to summary
public static final EnumSet<HttpHeader> DO_NOT_HUFFMAN
DO_NOT_INDEXback to summary
public static final EnumSet<HttpHeader> DO_NOT_INDEX
lockback to summary
private final AutoLock lock
LOGback to summary
private static final Logger LOG
NEVER_INDEXback to summary
public static final EnumSet<HttpHeader> NEVER_INDEX

Constructor Detail

QpackEncoderback to summary
public QpackEncoder(Instruction.Handler handler)

Method Detail

dumpback to summary
public void dump(Appendable out, String indent) throws IOException

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Doc from org.eclipse.jetty.util.component.Dumpable.dump.

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.

Annotations
@Override
Exceptions
IOException:
if unable to write to Appendable
encodeback to summary
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.

Parameters
buffer:ByteBuffer

the buffer to take the bytes of the encoded MetaData.

streamId:long

the stream ID corresponding to this headers frame.

metadata:MetaData

the MetaData to encode into the buffer.

Exceptions
QpackException:
if there was an error with the QPACK compression.
encodeback to summary
private EncodableEntry encode(StreamInfo streamInfo, HttpField field)
encodeInsertCountback to summary
private static int encodeInsertCount(int reqInsertCount, int maxTableCapacity)
getInstructionHandlerback to summary
pack-priv QpackEncoder.InstructionHandler getInstructionHandler()
getMaxBlockedStreamsback to summary
public int getMaxBlockedStreams()
getMaxHeadersSizeback to summary
public int getMaxHeadersSize()
getMaxTableCapacityback to summary
public int getMaxTableCapacity()
getStreamInfoMapback to summary
pack-priv Map<Long, StreamInfo> getStreamInfoMap()
getTableCapacityback to summary
public int getTableCapacity()
insertback to summary
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.

Parameters
field:HttpField

the field to insert into the Dynamic Table.

Returns:boolean

true if the field was successfully inserted into the Dynamic Table.

notifyInstructionHandlerback to summary
private void notifyInstructionHandler()
parseInstructionsback to summary
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.

Parameters
buffer:ByteBuffer

a buffer containing bytes from the Decoder stream.

Exceptions
QpackException:
if there was an error parsing or handling the instructions.
referenceEntryback to summary
private boolean referenceEntry(Entry entry, StreamInfo streamInfo)
setMaxBlockedStreamsback to summary
public void setMaxBlockedStreams(int maxBlockedStreams)
setMaxHeadersSizeback to summary
public void setMaxHeadersSize(int maxHeadersSize)
setMaxTableCapacityback to summary
public void setMaxTableCapacity(int maxTableCapacity)
setTableCapacityback to summary
public void setTableCapacity(int capacity)

Set the capacity of the DynamicTable and send a instruction to set the capacity on the remote Decoder.

Parameters
capacity:int

the new capacity.

shouldHuffmanEncodeback to summary
protected boolean shouldHuffmanEncode(HttpField httpField)
shouldIndexback to summary
protected boolean shouldIndex(HttpField httpField)
streamCancellationback to summary
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.

Parameters
streamId:long

the streamId of the stream that was cancelled.

org.eclipse.jetty.http3.qpack back to summary

pack-priv Class QpackEncoder.InstructionHandler

extends Object
implements Handler
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.http3.qpack.QpackEncoder.InstructionHandler
All Implemented Interfaces
org.eclipse.jetty.http3.qpack.internal.parser.EncoderInstructionParser.Handler

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

InstructionHandlerback to summary
pack-priv InstructionHandler()

Method Detail

onInsertCountIncrementback to summary
public void onInsertCountIncrement(int increment) throws QpackException

Implements org.eclipse.jetty.http3.qpack.internal.parser.EncoderInstructionParser.Handler.onInsertCountIncrement.

Annotations
@Override
onSectionAcknowledgementback to summary
public void onSectionAcknowledgement(long streamId) throws QpackException

Implements org.eclipse.jetty.http3.qpack.internal.parser.EncoderInstructionParser.Handler.onSectionAcknowledgement.

Annotations
@Override
onStreamCancellationback to summary
public void onStreamCancellation(long streamId)

Implements org.eclipse.jetty.http3.qpack.internal.parser.EncoderInstructionParser.Handler.onStreamCancellation.

Annotations
@Override