Class QuicheStream
- All Implemented Interfaces:
CyclicTimeouts.Expirable
,Stream
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.quic.api.Stream
Stream.Listener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
data
(boolean last, List<ByteBuffer> buffers, Promise.Invocable<Stream> promise) Sends a STREAM frame with the given data bytes and the indication of whether they are the last to be sent.void
dataBlocked
(long offset, Promise.Invocable<Stream> promise) Sends a STREAM_DATA_BLOCKED frame, with the given offset.void
demand()
Demands more data bytes for this stream.void
disconnect
(long appErrorCode, Throwable failure, Promise.Invocable<Stream> promise) Abruptly terminates this stream with the given error.Returns theSession
this stream is associated to.boolean
isClosed()
Returns whether the stream is fully closed, both locally and remotely.boolean
Returns whether the stream is locally closed.boolean
Returns whether the stream is remotely closed.void
maxData
(long maxData, Promise.Invocable<Stream> promise) Sends a MAX_STREAM_DATA frame with the new total max data bytes that this peer is willing to receive.read()
Reads data from this stream, if any.void
reset
(long appErrorCode, Promise.Invocable<Stream> promise) Sends a RESET_STREAM frame, with the given application error code.void
setIdleTimeout
(long idleTimeout) void
stopSending
(long appErrorCode, Promise.Invocable<Stream> promise) Sends a STOP_SENDING frame, with the given application error code.toString()
Methods inherited from class org.eclipse.jetty.quic.common.AbstractStream
getExpireNanoTime, getId, getIdleTimeout, getListener, isBidirectional, isLocal, notIdle, setListener
-
Constructor Details
-
QuicheStream
-
-
Method Details
-
isClosed
public boolean isClosed()Description copied from interface:Stream
Returns whether the stream is fully closed, both locally and remotely.
- Returns:
- whether the stream is fully closed
- See Also:
-
isLocallyClosed
public boolean isLocallyClosed()Description copied from interface:Stream
Returns whether the stream is locally closed.
A locally closed stream will not send further data.
A stream becomes locally closed when either it has sent
the last data
, or issued aStream.reset(long, Promise.Invocable)
.- Returns:
- whether the stream is locally closed
- See Also:
-
isRemotelyClosed
public boolean isRemotelyClosed()Description copied from interface:Stream
Returns whether the stream is remotely closed.
A remotely closed stream will not receive further data.
A stream becomes remotely closed when it has
Stream.read()
the last data.- Returns:
- whether the stream is remotely closed
- See Also:
-
getSession
-
read
Description copied from interface:Stream
Reads data from this stream, if any.
The returned
Content.Chunk
object may benull
indicating that the end of the read side of the stream has not yet been reached, which may happen when not all the bytes have been received so far, for example the remote peer did not send them yet, or they are in-flight.When the returned
Content.Chunk
object is notnull
, the flow control window has been enlarged by the data length. Applications must call, either immediately or later (even asynchronously from a different thread)Retainable.release()
to notify the implementation that the bytes have been processed.Content.Chunk
objects may be stored away for later, asynchronous, processing (for example, to process them only when all of them have been received).Once the returned
Content.Chunk
object indicates that the end of the read side of the stream has been reached, further calls to this method will return aContent.Chunk
object with the same indication, although the instance may be different.- Returns:
- a
Content.Chunk
object containing the data bytes or a failure, ornull
if no data bytes are available - See Also:
-
demand
public void demand()Description copied from interface:Stream
Demands more data bytes for this stream.
Calling this method causes
Stream.Listener.onDataAvailable(Stream)
to be invoked, possibly at a later time, when the stream has data to be read, but also when the stream has reached EOF.This method is idempotent: calling it when there already is an outstanding demand to invoke
Stream.Listener.onDataAvailable(Stream)
is a no-operation.The thread invoking this method may invoke directly
Stream.Listener.onDataAvailable(Stream)
, unless another thread that must invokeStream.Listener.onDataAvailable(Stream)
notices the outstanding demand first.It is always guaranteed that invoking this method from within
onDataAvailable(Stream)
will not cause aStackOverflowError
.- See Also:
-
data
Description copied from interface:Stream
Sends a STREAM frame with the given data bytes and the indication of whether they are the last to be sent.
- Parameters:
last
- whether the data bytes are the lastbuffers
- the list of data bytes to sendpromise
- thePromise.Invocable
that gets notified when the data has been sent
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout) - Specified by:
setIdleTimeout
in interfaceStream
- Overrides:
setIdleTimeout
in classAbstractStream
-
maxData
Description copied from interface:Stream
Sends a MAX_STREAM_DATA frame with the new total max data bytes that this peer is willing to receive.
- Parameters:
maxData
- the max data bytes this peer is willing to receivepromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
reset
Description copied from interface:Stream
Sends a RESET_STREAM frame, with the given application error code.
- Parameters:
appErrorCode
- the application error codepromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
stopSending
Description copied from interface:Stream
Sends a STOP_SENDING frame, with the given application error code.
- Parameters:
appErrorCode
- the application error codepromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
dataBlocked
Description copied from interface:Stream
Sends a STREAM_DATA_BLOCKED frame, with the given offset.
- Parameters:
offset
- the data offsetpromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
disconnect
Description copied from interface:Stream
Abruptly terminates this stream with the given error.
This method removes this stream from its session and then terminates the QUIC stream, via
Stream.stopSending(long, Promise.Invocable)
, and then aStream.reset(long, Promise.Invocable)
.- Parameters:
appErrorCode
- the application error codefailure
- the failure that caused the disconnect of the streampromise
- thePromise.Invocable
that gets notified when the disconnect is completed
-
toString
- Overrides:
toString
in classAbstractStream
-