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
ConstructorDescriptionSharedBuffer
(io.netty.channel.EventLoop loop, BodySizeLimits limits, BufferConsumer.Upstream rootUpstream) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(io.netty.buffer.ByteBuf buf) Consume a buffer.void
complete()
Signal normal completion of the stream.void
Signal an upstream error.void
setExpectedLength
(long length) void
setExpectedLengthFrom
(io.netty.handler.codec.http.HttpHeaders headers) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:BufferConsumer
Consume a buffer. Release ownership is transferred to this consumer.- Specified by:
add
in interfaceBufferConsumer
- Parameters:
buf
- The buffer to consume
-
complete
public void complete()Description copied from interface:BufferConsumer
Signal normal completion of the stream.- Specified by:
complete
in interfaceBufferConsumer
-
error
Description copied from interface:BufferConsumer
Signal an upstream error.- Specified by:
error
in interfaceBufferConsumer
- Parameters:
e
- The error
-