Package io.micronaut.http.netty.body
Class NettyBodyAdapter
java.lang.Object
io.micronaut.http.body.AbstractBodyAdapter<io.netty.buffer.ByteBuf,StreamingNettyByteBody.SharedBuffer>
io.micronaut.http.netty.body.NettyBodyAdapter
- All Implemented Interfaces:
BufferConsumer.Upstream,Subscriber<io.netty.buffer.ByteBuf>
@Internal
public final class NettyBodyAdapter
extends AbstractBodyAdapter<io.netty.buffer.ByteBuf,StreamingNettyByteBody.SharedBuffer>
Adapter from generic streaming
ByteBody to StreamingNettyByteBody.- Since:
- 4.6.0
- Author:
- Jonas Konrad
-
Field Summary
Fields inherited from class io.micronaut.http.body.AbstractBodyAdapter
demand, sharedBuffer, subscription -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull NettyByteBodyTransform the given body to aNettyByteBody.static StreamingNettyByteBodystatic StreamingNettyByteBodyadapt(Publisher<io.netty.buffer.ByteBuf> publisher, io.netty.channel.EventLoop eventLoop, @Nullable io.netty.handler.codec.http.HttpHeaders headersForLength, @Nullable Runnable onDiscard) voidvoidvoidonNext(io.netty.buffer.ByteBuf bytes) Methods inherited from class io.micronaut.http.body.AbstractBodyAdapter
allowDiscard, disregardBackpressure, onBytesConsumed, onSubscribe, start
-
Method Details
-
adapt
@NonNull public static @NonNull NettyByteBody adapt(@NonNull @NonNull ByteBody body, @NonNull @NonNull io.netty.channel.EventLoop eventLoop) Transform the given body to aNettyByteBody.- Parameters:
body- The generic bodyeventLoop- The event loop for task serialization- Returns:
- The adapted body
-
adapt
public static StreamingNettyByteBody adapt(Publisher<io.netty.buffer.ByteBuf> publisher, io.netty.channel.EventLoop eventLoop) -
adapt
-
onNext
public void onNext(io.netty.buffer.ByteBuf bytes) -
onError
- Specified by:
onErrorin interfaceSubscriber<io.netty.buffer.ByteBuf>- Overrides:
onErrorin classAbstractBodyAdapter<io.netty.buffer.ByteBuf,StreamingNettyByteBody.SharedBuffer>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceSubscriber<io.netty.buffer.ByteBuf>- Overrides:
onCompletein classAbstractBodyAdapter<io.netty.buffer.ByteBuf,StreamingNettyByteBody.SharedBuffer>
-