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

pack-priv final Class QuicStreamIntReader

extends Object
Class Inheritance
Imports
jdk.internal.net.http.common.Logger, .MinimalFuture, .SequentialScheduler, jdk.internal.net.http.quic.VariableLengthEncoder, jdk.internal.net.http.quic.streams.QuicReceiverStream, .QuicStreamReader, java.nio.ByteBuffer, java.util.concurrent.CompletableFuture

A class that reads VL integers from a QUIC stream.

After constructing an instance of this class, the application is can call readInt() to read one VL integer off the stream. When the read operation completes, the application can call readInt again, or call stop() to disconnect the reader.

Field Summary

Modifier and TypeField and Description
private CompletableFuture<Long>
private final Logger
private final QuicStreamReader
private final SequentialScheduler
private final QuicReceiverStream
private ByteBuffer

Constructor Summary

AccessConstructor and Description
public
QuicStreamIntReader(QuicReceiverStream
a receiver stream with no connected reader
stream
,
Logger
a logger
debug
)

Creates a QuicStreamIntReader for the given stream.

Method Summary

Modifier and TypeMethod and Description
private void
public synchronized CompletableFuture<Long>

Returns:

a CompletableFuture<Long> that will be completed with the decoded number, or -1 if the stream is terminated before the complete number could be read, or an exception if the stream is reset or decoding fails.
readInt
()

Starts a read operation to decode a single number.

public synchronized void
stop()

Stops and disconnects this reader.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cfback to summary
private CompletableFuture<Long> cf
debugback to summary
private final Logger debug
readerback to summary
private final QuicStreamReader reader
schedulerback to summary
private final SequentialScheduler scheduler
streamback to summary
private final QuicReceiverStream stream
vlongBufback to summary
private ByteBuffer vlongBuf

Constructor Detail

QuicStreamIntReaderback to summary
public QuicStreamIntReader(QuicReceiverStream stream, Logger debug)

Creates a QuicStreamIntReader for the given stream.

Parameters
stream:QuicReceiverStream

a receiver stream with no connected reader

debug:Logger

a logger

Method Detail

dispatchback to summary
private void dispatch()
readIntback to summary
public synchronized CompletableFuture<Long> readInt()

Starts a read operation to decode a single number.

Returns:CompletableFuture<Long>

a CompletableFuture<Long> that will be completed with the decoded number, or -1 if the stream is terminated before the complete number could be read, or an exception if the stream is reset or decoding fails.

Exceptions
IllegalStateException:
if the reader is stopped, or if a read operation is already in progress
stopback to summary
public synchronized void stop()

Stops and disconnects this reader. This operation must not be done when a read operation is in progress. If cancelling a read operation is intended, use QuicReceiverStream#requestStopSending(long).

Exceptions
IllegalStateException:
if a read operation is currently in progress.