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 AbstractBodyAdaptercreateBodyAdapter(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 CloseableAvailableByteBodyempty()Get the underlyingReadBufferFactory.static io.netty.buffer.ByteBuftoByteBuf(AvailableByteBody body) static reactor.core.publisher.Flux<io.netty.buffer.ByteBuf>toByteBufs(ByteBody body) toStreaming(ByteBody body) Convert aByteBodyinto aBaseStreamingByteBodywith 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:ByteBodyFactoryGet the underlyingReadBufferFactory.- Overrides:
readBufferFactoryin classByteBodyFactory- Returns:
- The factory
-
createStreamingBody
public ByteBodyFactory.StreamingBody createStreamingBody(BodySizeLimits limits, BufferConsumer.Upstream upstream) Description copied from class:ByteBodyFactoryCreate a new streaming body to push data into. Internal API.- Overrides:
createStreamingBodyin 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:ByteBodyFactoryCreate a new body adapter for transforming a publisher into aByteBody. Internal API.- Overrides:
createBodyAdapterin 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:ByteBodyFactoryConvert aByteBodyinto aBaseStreamingByteBodywith the same content. Internal API.- Overrides:
toStreamingin classByteBodyFactory- Parameters:
body- The body to convert- Returns:
- A streaming body with the same content
-