APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http.quic.streams

public Class CryptoWriterQueue

extends Object
Class Inheritance
Imports
jdk.internal.net.http.quic.frames.CryptoFrame, jdk.internal.net.http.quic.VariableLengthEncoder, java.nio.ByteBuffer, java.util.ArrayDeque, .Iterator, .Queue

Class that buffers crypto data received from QuicTLSEngine. Generates CryptoFrames of requested size. Normally the frames are produced sequentially. However, when the client receives a Retry packet or a Version Negotiation packet, the client hello needs to be replayed. In that case we need to keep the processed data in the queues.

Field Summary

Modifier and TypeField and Description
private boolean
private long
private final Queue<ByteBuffer>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
discardReplayData()

Notify the writer to stop keeping processed data.

public synchronized void
enqueue(ByteBuffer
data to enqueue
buffer
)

Enqueues the provided crypto data

public synchronized void
keepReplayData()

Notify the writer to start keeping processed data.

public synchronized CryptoFrame

Returns:

frame with next portion of crypto data, or null
produceFrame
(int
maximum size of the returned frame, in bytes
maxSize
)

Stores the next portion of queued crypto data in a frame.

public synchronized int

Returns:

the current number of buffered bytes
remaining
()

Returns the current number of buffered bytes.

public synchronized void
replayData()

Rewinds the enqueued buffer positions to allow for replaying the data

public synchronized void
reset()

Clears the queue and resets position back to zero

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keepReplayDataback to summary
private boolean keepReplayData
positionback to summary
private long position
queueback to summary
private final Queue<ByteBuffer> queue
totalRemainingback to summary
private int totalRemaining

Constructor Detail

CryptoWriterQueueback to summary
public CryptoWriterQueue()

Method Detail

discardReplayDataback to summary
public synchronized void discardReplayData()

Notify the writer to stop keeping processed data.

enqueueback to summary
public synchronized void enqueue(ByteBuffer buffer)

Enqueues the provided crypto data

Parameters
buffer:ByteBuffer

data to enqueue

keepReplayDataback to summary
public synchronized void keepReplayData()

Notify the writer to start keeping processed data. Can only be called on a fresh writer.

Exceptions
IllegalStateException:
if some data was processed already
produceFrameback to summary
public synchronized CryptoFrame produceFrame(int maxSize)

Stores the next portion of queued crypto data in a frame. May return null if there's no data to enqueue or if maxSize is too small to fit at least one byte of data. The produced frame may be shorter than maxSize even if there are remaining bytes.

Parameters
maxSize:int

maximum size of the returned frame, in bytes

Returns:CryptoFrame

frame with next portion of crypto data, or null

Exceptions
IllegalArgumentException:
if maxSize < 0
remainingback to summary
public synchronized int remaining()

Returns the current number of buffered bytes.

Returns:int

the current number of buffered bytes

replayDataback to summary
public synchronized void replayData()

Rewinds the enqueued buffer positions to allow for replaying the data

Exceptions
IllegalStateException:
if replay data is not available
resetback to summary
public synchronized void reset()

Clears the queue and resets position back to zero