Package io.micronaut.http.netty.body
Class NettyJsonStreamHandler<T>
java.lang.Object
io.micronaut.http.netty.body.NettyJsonStreamHandler<T>
- Type Parameters:
- T- The type
- All Implemented Interfaces:
- ChunkedMessageBodyReader<T>,- MessageBodyHandler<T>,- MessageBodyReader<T>,- MessageBodyWriter<T>,- CustomizableJsonHandler
@Internal
@Singleton
@Produces("application/x-json-stream")
@Consumes("application/x-json-stream")
public final class NettyJsonStreamHandler<T>
extends Object
implements MessageBodyHandler<T>, ChunkedMessageBodyReader<T>, CustomizableJsonHandler
Netty json stream implementation for MessageBodyHandler.
- Since:
- 4.0.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncustomize(JsonFeatures jsonFeatures) booleanisReadable(Argument<T> type, MediaType mediaType) Is the type readable.Reads an object from the given byte buffer.Reads an object from the given byte buffer.reactor.core.publisher.Flux<T>readChunked(Argument<T> type, MediaType mediaType, Headers httpHeaders, Publisher<ByteBuffer<?>> input) ByteBuffer<?>writeTo(Argument<T> type, MediaType mediaType, T object, MutableHeaders outgoingHeaders, ByteBufferFactory<?, ?> bufferFactory) Writes an object to the given stream.voidwriteTo(Argument<T> type, MediaType mediaType, T object, MutableHeaders outgoingHeaders, OutputStream outputStream) Writes an object to the given output stream.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.body.MessageBodyWritercreateSpecific, isBlocking, isWriteable
- 
Constructor Details- 
NettyJsonStreamHandler
 
- 
- 
Method Details- 
customize- Specified by:
- customizein interface- CustomizableJsonHandler
 
- 
isReadableDescription copied from interface:MessageBodyReaderIs the type readable.- Specified by:
- isReadablein interface- MessageBodyReader<T>
- Parameters:
- type- The type
- mediaType- The media type, can be- null
- Returns:
- True if is readable
 
- 
readpublic T read(Argument<T> type, MediaType mediaType, Headers httpHeaders, ByteBuffer<?> byteBuffer) throws CodecException Description copied from interface:MessageBodyReaderReads an object from the given byte buffer.- Specified by:
- readin interface- MessageBodyReader<T>
- Parameters:
- type- The type being decoded.
- mediaType- The media type, can be- null
- httpHeaders- The HTTP headers
- byteBuffer- The byte buffer
- Returns:
- The read object or null
- Throws:
- CodecException- If an error occurs decoding
 
- 
readpublic T read(Argument<T> type, MediaType mediaType, Headers httpHeaders, InputStream inputStream) throws CodecException Description copied from interface:MessageBodyReaderReads an object from the given byte buffer.- Specified by:
- readin interface- MessageBodyReader<T>
- Parameters:
- type- The type being decoded.
- mediaType- The media type, can be- null
- httpHeaders- The HTTP headers
- inputStream- The input stream
- Returns:
- The read object or null
- Throws:
- CodecException- If an error occurs decoding
 
- 
readChunkedpublic reactor.core.publisher.Flux<T> readChunked(Argument<T> type, MediaType mediaType, Headers httpHeaders, Publisher<ByteBuffer<?>> input) - Specified by:
- readChunkedin interface- ChunkedMessageBodyReader<T>
 
- 
writeTopublic void writeTo(Argument<T> type, MediaType mediaType, T object, MutableHeaders outgoingHeaders, OutputStream outputStream) throws CodecException Description copied from interface:MessageBodyWriterWrites an object to the given output stream.- Specified by:
- writeToin interface- MessageBodyWriter<T>
- Parameters:
- type- The type
- mediaType- The media type
- object- The object to write
- outgoingHeaders- The HTTP headers
- outputStream- The output stream
- Throws:
- CodecException- If an error occurs decoding
 
- 
writeTopublic ByteBuffer<?> writeTo(Argument<T> type, MediaType mediaType, T object, MutableHeaders outgoingHeaders, ByteBufferFactory<?, ?> bufferFactory) throws CodecExceptionDescription copied from interface:MessageBodyWriterWrites an object to the given stream.- Specified by:
- writeToin interface- MessageBodyWriter<T>
- Parameters:
- type- The type
- mediaType- The media type
- object- The object to write
- outgoingHeaders- The HTTP headers
- bufferFactory- A byte buffer factory
- Returns:
- The encoded byte buffer
- Throws:
- CodecException- If an error occurs decoding
 
 
-