Top Description Methods
io.netty5.handler.codec.http2

public Interface Http2LocalFlowController

extends Http2FlowController
Known Direct Implementers
io.netty5.handler.codec.http2.DefaultHttp2LocalFlowController, io.netty5.handler.codec.http2.DelegatingDecompressorFrameListener.ConsumedBytesConverter
Annotations
@UnstableApi
Imports
io.netty5.buffer.Buffer, io.netty5.util.internal.UnstableApi

A Http2FlowController for controlling the inbound flow of DATA frames from the remote endpoint.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if a WINDOW_UPDATE was sent, false otherwise.
consumeBytes
(Http2Stream
the stream for which window space should be freed. The connection stream object must not be used. If stream is null or closed (i.e. Http2Stream#state() method returns Http2Stream.State#CLOSED), calling this method has no effect.
stream
,
int
the number of bytes to be returned to the flow control window.
numBytes
)

Indicates that the application has consumed a number of bytes for the given stream and is therefore ready to receive more data from the remote endpoint.

public Http2LocalFlowController
frameWriter(Http2FrameWriter
the HTTP/2 frame writer.
frameWriter
)

Sets the writer to be use for sending WINDOW_UPDATE frames.

public int
initialWindowSize(Http2Stream stream)

Get the initial flow control window size for the given stream.

public void
receiveFlowControlledFrame(Http2Stream
the subject stream for the received frame. The connection stream object must not be used. If stream is null or closed, flow control should only be applied to the connection window and the bytes are immediately consumed.
stream
,
Buffer
payload buffer for the frame.
data
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
endOfStream
)

Receives an inbound DATA frame from the remote endpoint and applies flow control policies to it for both the stream as well as the connection.

public int

Returns:

the number of unconsumed bytes for the stream.
unconsumedBytes
(Http2Stream
the stream for which window space should be freed.
stream
)

The number of bytes for the given stream that have been received but not yet consumed by the application.

Inherited from io.netty5.handler.codec.http2.Http2FlowController:
channelHandlerContextincrementWindowSizeinitialWindowSizeinitialWindowSizewindowSize

Method Detail

consumeBytesback to summary
public boolean consumeBytes(Http2Stream stream, int numBytes) throws Http2Exception

Indicates that the application has consumed a number of bytes for the given stream and is therefore ready to receive more data from the remote endpoint. The application must consume any bytes that it receives or the flow control window will collapse. Consuming bytes enables the flow controller to send WINDOW_UPDATE to restore a portion of the flow control window for the stream.

If stream is null or closed (i.e. Http2Stream#state() method returns Http2Stream.State#CLOSED), calling this method has no effect.

Parameters
stream:Http2Stream

the stream for which window space should be freed. The connection stream object must not be used. If stream is null or closed (i.e. Http2Stream#state() method returns Http2Stream.State#CLOSED), calling this method has no effect.

numBytes:int

the number of bytes to be returned to the flow control window.

Returns:boolean

true if a WINDOW_UPDATE was sent, false otherwise.

Exceptions
Http2Exception:
if the number of bytes returned exceeds the unconsumedBytes(Http2Stream) for the stream.
frameWriterback to summary
public Http2LocalFlowController frameWriter(Http2FrameWriter frameWriter)

Sets the writer to be use for sending WINDOW_UPDATE frames. This must be called before any flow controlled data is received.

Parameters
frameWriter:Http2FrameWriter

the HTTP/2 frame writer.

initialWindowSizeback to summary
public int initialWindowSize(Http2Stream stream)

Get the initial flow control window size for the given stream. This quantity is measured in number of bytes. Note the unavailable window portion can be calculated by initialWindowSize() - windowSize(Http2Stream).

receiveFlowControlledFrameback to summary
public void receiveFlowControlledFrame(Http2Stream stream, Buffer data, int padding, boolean endOfStream) throws Http2Exception

Receives an inbound DATA frame from the remote endpoint and applies flow control policies to it for both the stream as well as the connection. If any flow control policies have been violated, an exception is raised immediately, otherwise the frame is considered to have "passed" flow control.

If stream is null or closed, flow control should only be applied to the connection window and the bytes are immediately consumed.

Parameters
stream:Http2Stream

the subject stream for the received frame. The connection stream object must not be used. If stream is null or closed, flow control should only be applied to the connection window and the bytes are immediately consumed.

data:Buffer

payload buffer for the frame.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endOfStream:boolean

Indicates whether this is the last frame to be sent from the remote endpoint for this stream.

Exceptions
Http2Exception:
if any flow control errors are encountered.
unconsumedBytesback to summary
public int unconsumedBytes(Http2Stream stream)

The number of bytes for the given stream that have been received but not yet consumed by the application.

Parameters
stream:Http2Stream

the stream for which window space should be freed.

Returns:int

the number of unconsumed bytes for the stream.