Package io.micronaut.http.netty.body
Class NettyByteBodyFactory
java.lang.Object
io.micronaut.http.body.ByteBodyFactory
io.micronaut.http.netty.body.NettyByteBodyFactory
ByteBodyFactory
implementation with netty-optimized bodies.- Since:
- 4.8.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested classes/interfaces inherited from class io.micronaut.http.body.ByteBodyFactory
ByteBodyFactory.StreamingBody
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadapt
(io.netty.buffer.ByteBuf byteBuf) adapt
(Publisher<io.netty.buffer.ByteBuf> publisher, @Nullable io.netty.handler.codec.http.HttpHeaders headersForLength, @Nullable Runnable onDiscard) adaptNetty
(Publisher<io.netty.buffer.ByteBuf> publisher) protected AbstractBodyAdapter
createBodyAdapter
(Publisher<ReadBuffer> publisher, Runnable onDiscard) Create a new body adapter for transforming a publisher into aByteBody
.createChecked
(@NonNull BodySizeLimits bodySizeLimits, @NonNull io.netty.buffer.ByteBuf buf) createStreamingBody
(BodySizeLimits limits, BufferConsumer.Upstream upstream) Create a new streaming body to push data into.createStreamingBuffer
(BodySizeLimits limits, BufferConsumer.Upstream rootUpstream) static CloseableAvailableByteBody
empty()
Get the underlyingReadBufferFactory
.static io.netty.buffer.ByteBuf
toByteBuf
(AvailableByteBody body) static reactor.core.publisher.Flux<io.netty.buffer.ByteBuf>
toByteBufs
(ByteBody body) toStreaming
(ByteBody body) Convert aByteBody
into aBaseStreamingByteBody
with the same content.Methods inherited from class io.micronaut.http.body.ByteBodyFactory
adapt, adapt, adapt, adapt, adapt, adapt, buffer, byteBufferFactory, copyOf, copyOf, createDefault, createEmpty
-
Constructor Details
-
NettyByteBodyFactory
-
-
Method Details
-
readBufferFactory
Description copied from class:ByteBodyFactory
Get the underlyingReadBufferFactory
.- Overrides:
readBufferFactory
in classByteBodyFactory
- Returns:
- The factory
-
createStreamingBody
public ByteBodyFactory.StreamingBody createStreamingBody(BodySizeLimits limits, BufferConsumer.Upstream upstream) Description copied from class:ByteBodyFactory
Create a new streaming body to push data into. Internal API.- Overrides:
createStreamingBody
in classByteBodyFactory
- Parameters:
limits
- The input limitsupstream
- The upstream for backpressure- Returns:
- The streaming body tuple
-
createBodyAdapter
protected AbstractBodyAdapter createBodyAdapter(Publisher<ReadBuffer> publisher, Runnable onDiscard) Description copied from class:ByteBodyFactory
Create a new body adapter for transforming a publisher into aByteBody
. Internal API.- Overrides:
createBodyAdapter
in classByteBodyFactory
- Parameters:
publisher
- The publisher to transformonDiscard
- Optional runnable to run onBufferConsumer.Upstream.allowDiscard()
- Returns:
- The adapter
-
adapt
-
createChecked
public CloseableByteBody createChecked(@NonNull @NonNull BodySizeLimits bodySizeLimits, @NonNull @NonNull io.netty.buffer.ByteBuf buf) -
adaptNetty
-
adapt
-
empty
-
toByteBuf
-
toByteBufs
-
createStreamingBuffer
public StreamingNettyByteBody.SharedBuffer createStreamingBuffer(BodySizeLimits limits, BufferConsumer.Upstream rootUpstream) -
toStreaming
Description copied from class:ByteBodyFactory
Convert aByteBody
into aBaseStreamingByteBody
with the same content. Internal API.- Overrides:
toStreaming
in classByteBodyFactory
- Parameters:
body
- The body to convert- Returns:
- A streaming body with the same content
-