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

public abstract Class QuicStreamReader

extends Object
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.quic.streams.QuicReceiverStreamImpl.QuicStreamReaderImpl
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.Queue, jdk.internal.net.http.common.SequentialScheduler, jdk.internal.net.http.quic.streams.QuicReceiverStream.ReceivingStreamState

An abstract class to model a reader plugged into a QuicStream from which data can be read

Field Summary

Modifier and TypeField and Description
public static final ByteBuffer
EOF

A sentinel inserted into the queue after the FIN it has been received.

pack-priv final SequentialScheduler

Constructor Summary

AccessConstructor and Description
public
QuicStreamReader(SequentialScheduler
A sequential scheduler that will poll data out of this reader.
scheduler
)

Creates a new instance of a QuicStreamReader.

Method Summary

Modifier and TypeMethod and Description
public abstract boolean

Returns:

true if this reader is connected to its stream
connected
()

Returns true if this reader is connected to its stream.

public boolean

Returns:

whether reset was received or read by this reader
isReset
()

Returns whether reset was received or read by this reader.

public abstract ByteBuffer

Returns:

the ByteBuffer at the head of the queue, or null if no data is available
peek
()

Returns the ByteBuffer at the head of the queue, or null if no data is available.

public abstract ByteBuffer

Returns:

the ByteBuffer at the head of the queue, or null if no data is available
poll
()

Returns the ByteBuffer at the head of the queue, or null if no data is available.

public abstract QuicReceiverStream.ReceivingStreamState

Returns:

the receiving state of the stream
receivingState
()

Returns the receiving state of the stream.

public abstract void
start()

Starts the reader.

public abstract boolean

Returns:

true if this reader has been started
started
()

Returns true if this reader has been started.

public abstract QuicReceiverStream

Returns:

the stream this reader is connected to, or null if this reader is not currently connected
stream
()

Returns the stream this reader is connected to, or null if this reader is not currently connected.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EOFback to summary
public static final ByteBuffer EOF

A sentinel inserted into the queue after the FIN it has been received.

schedulerback to summary
pack-priv final SequentialScheduler scheduler

Constructor Detail

QuicStreamReaderback to summary
public QuicStreamReader(SequentialScheduler scheduler)

Creates a new instance of a QuicStreamReader. The given scheduler will not be invoked until the reader is started.

Parameters
scheduler:SequentialScheduler

A sequential scheduler that will poll data out of this reader.

Method Detail

connectedback to summary
public abstract boolean connected()

Returns true if this reader is connected to its stream.

Returns:boolean

true if this reader is connected to its stream

See Also
QuicReceiverStream#connectReader(SequentialScheduler), QuicReceiverStream#disconnectReader(QuicStreamReader)
isResetback to summary
public boolean isReset()

Returns whether reset was received or read by this reader.

Returns:boolean

whether reset was received or read by this reader

peekback to summary
public abstract ByteBuffer peek() throws IOException

Returns the ByteBuffer at the head of the queue, or null if no data is available.

Implementation Specification

This method behave just like Queue#peek().

Returns:ByteBuffer

the ByteBuffer at the head of the queue, or null if no data is available

Exceptions
IOException:
if the stream was reset by the peer
IllegalStateException:
if this reader is no longer connected to its stream
pollback to summary
public abstract ByteBuffer poll() throws IOException

Returns the ByteBuffer at the head of the queue, or null if no data is available. . If the end of the stream is reached then EOF is returned.

Implementation Specification

This method behave just like Queue#poll().

Returns:ByteBuffer

the ByteBuffer at the head of the queue, or null if no data is available

Exceptions
IOException:
if the stream was closed locally or reset by the peer
IllegalStateException:
if this reader is no longer connected to its stream
receivingStateback to summary
public abstract QuicReceiverStream.ReceivingStreamState receivingState()

Returns the receiving state of the stream.

API Note

This method returns the state of the QuicReceiverStream to which this writer is connected.

Returns:QuicReceiverStream.ReceivingStreamState

the receiving state of the stream

Exceptions
IllegalStateException:
if this reader is no longer connected to its stream
startback to summary
public abstract void start()

Starts the reader. The scheduler will not be invoked until the reader is started.

startedback to summary
public abstract boolean started()

Returns true if this reader has been started.

Returns:boolean

true if this reader has been started

streamback to summary
public abstract QuicReceiverStream stream()

Returns the stream this reader is connected to, or null if this reader is not currently connected.

Returns:QuicReceiverStream

the stream this reader is connected to, or null if this reader is not currently connected