Package io.micronaut.http.netty.body
Class NettyByteBufMessageBodyHandler
java.lang.Object
io.micronaut.http.netty.body.NettyByteBufMessageBodyHandler
- All Implemented Interfaces:
ChunkedMessageBodyReader<io.netty.buffer.ByteBuf>
,MessageBodyHandler<io.netty.buffer.ByteBuf>
,MessageBodyReader<io.netty.buffer.ByteBuf>
,MessageBodyWriter<io.netty.buffer.ByteBuf>
,TypedMessageBodyHandler<io.netty.buffer.ByteBuf>
,TypedMessageBodyReader<io.netty.buffer.ByteBuf>
,TypedMessageBodyWriter<io.netty.buffer.ByteBuf>
@Internal
@Singleton
public final class NettyByteBufMessageBodyHandler
extends Object
implements TypedMessageBodyHandler<io.netty.buffer.ByteBuf>, ChunkedMessageBodyReader<io.netty.buffer.ByteBuf>
Handler for netty
ByteBuf
.- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionArgument<io.netty.buffer.ByteBuf>
getType()
io.netty.buffer.ByteBuf
read
(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) Reads an object from the given byte buffer.io.netty.buffer.ByteBuf
read
(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, Headers httpHeaders, InputStream inputStream) Reads an object from the given byte buffer.Publisher<io.netty.buffer.ByteBuf>
readChunked
(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, Headers httpHeaders, Publisher<ByteBuffer<?>> input) ByteBuffer<?>
writeTo
(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, io.netty.buffer.ByteBuf object, MutableHeaders outgoingHeaders, ByteBufferFactory<?, ?> bufferFactory) Writes an object to the given stream.void
writeTo
(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, io.netty.buffer.ByteBuf object, MutableHeaders outgoingHeaders, OutputStream outputStream) Writes an object to the given output stream.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.body.MessageBodyWriter
createSpecific, isBlocking
Methods inherited from interface io.micronaut.http.body.TypedMessageBodyReader
isReadable
Methods inherited from interface io.micronaut.http.body.TypedMessageBodyWriter
isWriteable
-
Constructor Details
-
NettyByteBufMessageBodyHandler
public NettyByteBufMessageBodyHandler()
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceTypedMessageBodyHandler<io.netty.buffer.ByteBuf>
- Specified by:
getType
in interfaceTypedMessageBodyReader<io.netty.buffer.ByteBuf>
- Specified by:
getType
in interfaceTypedMessageBodyWriter<io.netty.buffer.ByteBuf>
- Returns:
- The body type.
-
readChunked
public Publisher<io.netty.buffer.ByteBuf> readChunked(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, Headers httpHeaders, Publisher<ByteBuffer<?>> input) - Specified by:
readChunked
in interfaceChunkedMessageBodyReader<io.netty.buffer.ByteBuf>
-
read
public io.netty.buffer.ByteBuf read(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) throws CodecException Description copied from interface:MessageBodyReader
Reads an object from the given byte buffer.- Specified by:
read
in interfaceMessageBodyReader<io.netty.buffer.ByteBuf>
- Parameters:
type
- The type being decoded.mediaType
- The media type, can benull
httpHeaders
- The HTTP headersbyteBuffer
- The byte buffer- Returns:
- The read object or
null
- Throws:
CodecException
- If an error occurs decoding
-
read
public io.netty.buffer.ByteBuf read(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, Headers httpHeaders, InputStream inputStream) throws CodecException Description copied from interface:MessageBodyReader
Reads an object from the given byte buffer.- Specified by:
read
in interfaceMessageBodyReader<io.netty.buffer.ByteBuf>
- Parameters:
type
- The type being decoded.mediaType
- The media type, can benull
httpHeaders
- The HTTP headersinputStream
- The input stream- Returns:
- The read object or
null
- Throws:
CodecException
- If an error occurs decoding
-
writeTo
public void writeTo(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, io.netty.buffer.ByteBuf object, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException Description copied from interface:MessageBodyWriter
Writes an object to the given output stream.- Specified by:
writeTo
in interfaceMessageBodyWriter<io.netty.buffer.ByteBuf>
- Parameters:
type
- The typemediaType
- The media typeobject
- The object to writeoutgoingHeaders
- The HTTP headersoutputStream
- The output stream- Throws:
CodecException
- If an error occurs decoding
-
writeTo
public ByteBuffer<?> writeTo(Argument<io.netty.buffer.ByteBuf> type, MediaType mediaType, io.netty.buffer.ByteBuf object, MutableHeaders outgoingHeaders, ByteBufferFactory<?, ?> bufferFactory) throws CodecExceptionDescription copied from interface:MessageBodyWriter
Writes an object to the given stream.- Specified by:
writeTo
in interfaceMessageBodyWriter<io.netty.buffer.ByteBuf>
- Parameters:
type
- The typemediaType
- The media typeobject
- The object to writeoutgoingHeaders
- The HTTP headersbufferFactory
- A byte buffer factory- Returns:
- The encoded byte buffer
- Throws:
CodecException
- If an error occurs decoding
-