Class StreamingNettyByteBody.SharedBuffer
java.lang.Object
io.micronaut.http.server.netty.body.StreamingNettyByteBody.SharedBuffer
- All Implemented Interfaces:
BufferConsumer
- Enclosing class:
- StreamingNettyByteBody
public static final class StreamingNettyByteBody.SharedBuffer
extends Object
implements BufferConsumer
This class buffers input data and distributes it to multiple
StreamingNettyByteBody
instances.
Thread safety: The BufferConsumer methods must only be called from one
thread, the eventLoop thread. The other methods (subscribe, reserve) can be
called from any thread.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.http.server.netty.body.BufferConsumer
BufferConsumer.Upstream -
Constructor Summary
ConstructorsConstructorDescriptionSharedBuffer(io.netty.channel.EventLoop loop, BodySizeLimits limits, BufferConsumer.Upstream rootUpstream) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(io.netty.buffer.ByteBuf buf) Consume a buffer.voidcomplete()Signal normal completion of the stream.voidSignal an upstream error.voidsetExpectedLength(long length) voidsetExpectedLengthFrom(io.netty.handler.codec.http.HttpHeaders headers) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.server.netty.body.BufferConsumer
discard
-
Constructor Details
-
SharedBuffer
public SharedBuffer(io.netty.channel.EventLoop loop, BodySizeLimits limits, BufferConsumer.Upstream rootUpstream)
-
-
Method Details
-
setExpectedLengthFrom
public void setExpectedLengthFrom(io.netty.handler.codec.http.HttpHeaders headers) -
setExpectedLength
public void setExpectedLength(long length) -
add
public void add(io.netty.buffer.ByteBuf buf) Description copied from interface:BufferConsumerConsume a buffer. Release ownership is transferred to this consumer.- Specified by:
addin interfaceBufferConsumer- Parameters:
buf- The buffer to consume
-
complete
public void complete()Description copied from interface:BufferConsumerSignal normal completion of the stream.- Specified by:
completein interfaceBufferConsumer
-
error
Description copied from interface:BufferConsumerSignal an upstream error.- Specified by:
errorin interfaceBufferConsumer- Parameters:
e- The error
-