Package io.micronaut.jackson.parser
Class JacksonProcessor
java.lang.Object
io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber<R>
io.micronaut.core.async.processor.SingleThreadedBufferingProcessor<byte[],com.fasterxml.jackson.databind.JsonNode>
io.micronaut.jackson.parser.JacksonProcessor
- All Implemented Interfaces:
Completable
,Emitter<byte[]>
,Processor<byte[],
,com.fasterxml.jackson.databind.JsonNode> Publisher<com.fasterxml.jackson.databind.JsonNode>
,Subscriber<byte[]>
public class JacksonProcessor
extends SingleThreadedBufferingProcessor<byte[],com.fasterxml.jackson.databind.JsonNode>
A Reactive streams publisher that publishes a
JsonNode
once the JSON has been fully consumed.
Uses NonBlockingJsonParser
internally allowing the parsing of
JSON from an incoming stream of bytes in a non-blocking manner- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Nested classes/interfaces inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
SingleThreadedBufferingSubscriber.BackPressureState, SingleThreadedBufferingSubscriber.DownstreamSubscription
-
Field Summary
Fields inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
upstreamBuffer, upstreamDemand, upstreamState, upstreamSubscription
-
Constructor Summary
ConstructorDescriptionDefault constructor.JacksonProcessor
(com.fasterxml.jackson.core.JsonFactory jsonFactory) Construct with given JSON factory.JacksonProcessor
(com.fasterxml.jackson.core.JsonFactory jsonFactory, boolean streamArray) Creates a new JacksonProcessor.JacksonProcessor
(com.fasterxml.jackson.core.JsonFactory jsonFactory, boolean streamArray, @Nullable com.fasterxml.jackson.databind.DeserializationConfig deserializationConfig) Creates a new JacksonProcessor.JacksonProcessor
(com.fasterxml.jackson.core.JsonFactory jsonFactory, com.fasterxml.jackson.databind.DeserializationConfig deserializationConfig) Construct with given JSON factory.JacksonProcessor
(com.fasterxml.jackson.databind.DeserializationConfig deserializationConfig) Construct with default JSON factory. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
ImplementSubscriber.onComplete()
.boolean
protected void
onUpstreamMessage
(byte[] message) Called when a message is received from the upstreamSubscriber
.Methods inherited from class io.micronaut.core.async.processor.SingleThreadedBufferingProcessor
currentDownstreamSubscriber, doOnError, doOnNext, doOnSubscribe, getDownstreamSubscriber, subscribe, subscribeDownstream
Methods inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
newDownstreamSubscription, onComplete, onError, onNext, onSubscribe, provideDownstreamSubscription
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.reactivestreams.Subscriber
onComplete, onError, onNext, onSubscribe
-
Constructor Details
-
JacksonProcessor
public JacksonProcessor(com.fasterxml.jackson.core.JsonFactory jsonFactory, boolean streamArray, @Nullable @Nullable com.fasterxml.jackson.databind.DeserializationConfig deserializationConfig) Creates a new JacksonProcessor.- Parameters:
jsonFactory
- The JSON factorystreamArray
- Whether arrays should be streameddeserializationConfig
- The jackson deserialization configuration
-
JacksonProcessor
public JacksonProcessor(com.fasterxml.jackson.core.JsonFactory jsonFactory, boolean streamArray) Creates a new JacksonProcessor.- Parameters:
jsonFactory
- The JSON factorystreamArray
- Whether arrays should be streamed
-
JacksonProcessor
public JacksonProcessor(com.fasterxml.jackson.core.JsonFactory jsonFactory, com.fasterxml.jackson.databind.DeserializationConfig deserializationConfig) Construct with given JSON factory.- Parameters:
jsonFactory
- To configure and construct reader (aka parser,JsonParser
) and writer (aka generator,JsonGenerator
) instances.deserializationConfig
- The jackson deserialization configuration
-
JacksonProcessor
public JacksonProcessor(com.fasterxml.jackson.core.JsonFactory jsonFactory) Construct with given JSON factory.- Parameters:
jsonFactory
- To configure and construct reader (aka parser,JsonParser
) and writer (aka generator,JsonGenerator
) instances.
-
JacksonProcessor
public JacksonProcessor(com.fasterxml.jackson.databind.DeserializationConfig deserializationConfig) Construct with default JSON factory.- Parameters:
deserializationConfig
- The jackson deserialization configuration
-
JacksonProcessor
public JacksonProcessor()Default constructor.
-
-
Method Details
-
needMoreInput
public boolean needMoreInput()- Returns:
- Whether more input is needed
-
doOnComplete
protected void doOnComplete()Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onComplete()
.- Overrides:
doOnComplete
in classSingleThreadedBufferingProcessor<byte[],
com.fasterxml.jackson.databind.JsonNode>
-
onUpstreamMessage
protected void onUpstreamMessage(byte[] message) Description copied from class:SingleThreadedBufferingProcessor
Called when a message is received from the upstreamSubscriber
.- Specified by:
onUpstreamMessage
in classSingleThreadedBufferingProcessor<byte[],
com.fasterxml.jackson.databind.JsonNode> - Parameters:
message
- The message
-