Module io.netty.codec.http2
Package io.netty5.handler.codec.http2
Interface Http2RemoteFlowController.FlowControlled
-
- All Known Implementing Classes:
DefaultHttp2ConnectionEncoder.FlowControlledBase
- Enclosing interface:
- Http2RemoteFlowController
public static interface Http2RemoteFlowController.FlowControlledImplementations of this interface are used to progressively write chunks of the underlying payload to the stream. A payload is considered to be fully written ifwrite(io.netty5.channel.ChannelHandlerContext, int)has been called at least once and it'ssize()is now zero.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiderror(ChannelHandlerContext ctx, Throwable cause)Called to indicate that an error occurred before this object could be completely written.booleanmerge(ChannelHandlerContext ctx, Http2RemoteFlowController.FlowControlled next)Merge the contents of thenextmessage into this message so they can be written out as one unit.intsize()The size of the payload in terms of bytes applied to the flow-control window.voidwrite(ChannelHandlerContext ctx, int allowedBytes)Writes up toallowedBytesof the encapsulated payload to the stream.voidwriteComplete()Called after this object has been successfully written.
-
-
-
Method Detail
-
size
int size()
The size of the payload in terms of bytes applied to the flow-control window. Some payloads likeHEADERframes have no cost against flow control and would return 0 for this value even though they produce a non-zero number of bytes on the wire. Other frames likeDATAframes have both their payload and padding count against flow-control.
-
error
void error(ChannelHandlerContext ctx, Throwable cause)
Called to indicate that an error occurred before this object could be completely written.The
Http2RemoteFlowControllerwill make exactly one call to either this method orwriteComplete().- Parameters:
ctx- The context to use if any communication needs to occur as a result of the error. This may benullif an exception occurs when the connection has not been established yet.cause- of the error.
-
writeComplete
void writeComplete()
Called after this object has been successfully written.The
Http2RemoteFlowControllerwill make exactly one call to either this method orerror(ChannelHandlerContext, Throwable).
-
write
void write(ChannelHandlerContext ctx, int allowedBytes)
Writes up toallowedBytesof the encapsulated payload to the stream. Note that a value of 0 may be passed which will allow payloads with flow-control size == 0 to be written. The flow-controller may call this method multiple times with different values until the payload is fully written, i.e it's size after the write is 0.When an exception is thrown the
Http2RemoteFlowControllerwill make a call toerror(ChannelHandlerContext, Throwable).- Parameters:
ctx- The context to use for writing.allowedBytes- an upper bound on the number of bytes the payload can write at this time.
-
merge
boolean merge(ChannelHandlerContext ctx, Http2RemoteFlowController.FlowControlled next)
Merge the contents of thenextmessage into this message so they can be written out as one unit. This allows many small messages to be written as a single DATA frame.- Returns:
trueifnextwas successfully merged and does not need to be enqueued,falseotherwise.
-
-