Package io.micronaut.serde.support.util
Class BufferingJsonNodeProcessor
- java.lang.Object
-
- io.micronaut.serde.support.util.BufferingJsonNodeProcessor
-
- All Implemented Interfaces:
org.reactivestreams.Processor<byte[],io.micronaut.json.tree.JsonNode>,org.reactivestreams.Publisher<io.micronaut.json.tree.JsonNode>,org.reactivestreams.Subscriber<byte[]>
@Internal public abstract class BufferingJsonNodeProcessor extends java.lang.ObjectUtility class for buffering and parsing JSON to supportJsonMapper.createReactiveParser(java.util.function.Consumer, boolean).- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description BufferingJsonNodeProcessor(java.util.function.Consumer<org.reactivestreams.Processor<byte[],io.micronaut.json.tree.JsonNode>> onSubscribe, boolean streamArray)Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcomplete(java.util.Collection<io.micronaut.json.tree.JsonNode> out)voidonComplete()voidonError(java.lang.Throwable t)voidonNext(T t)voidonSubscribe(org.reactivestreams.Subscription s)protected io.micronaut.json.tree.JsonNodeparseOne(byte[] remaining)Parse a single node from the given stream.protected abstract io.micronaut.json.tree.JsonNodeparseOne(java.io.InputStream is)Parse a single node from the given stream.protected voidspread(byte[] bytes, java.util.Collection<io.micronaut.json.tree.JsonNode> out)voidsubscribe(org.reactivestreams.Subscriber<? super io.micronaut.json.tree.JsonNode> s)
-
-
-
Constructor Detail
-
BufferingJsonNodeProcessor
public BufferingJsonNodeProcessor(java.util.function.Consumer<org.reactivestreams.Processor<byte[],io.micronaut.json.tree.JsonNode>> onSubscribe, boolean streamArray)Default constructor.- Parameters:
onSubscribe- The onSubscribe callback.streamArray- Whether to stream an array.
-
-
Method Detail
-
subscribe
public void subscribe(org.reactivestreams.Subscriber<? super io.micronaut.json.tree.JsonNode> s)
- Specified by:
subscribein interfaceorg.reactivestreams.Publisher<io.micronaut.json.tree.JsonNode>
-
spread
protected void spread(byte[] bytes, java.util.Collection<io.micronaut.json.tree.JsonNode> out) throws java.io.IOException- Throws:
java.io.IOException
-
complete
protected void complete(java.util.Collection<io.micronaut.json.tree.JsonNode> out) throws java.io.IOException- Throws:
java.io.IOException
-
parseOne
@NonNull protected abstract io.micronaut.json.tree.JsonNode parseOne(@NonNull java.io.InputStream is) throws java.io.IOExceptionParse a single node from the given stream.- Parameters:
is- The input stream- Returns:
- The node
- Throws:
java.io.IOException- if an error occurs
-
parseOne
@NonNull protected io.micronaut.json.tree.JsonNode parseOne(@NonNull byte[] remaining) throws java.io.IOExceptionParse a single node from the given stream.- Parameters:
remaining- The bytes- Returns:
- The node
- Throws:
java.io.IOException- if an error occurs
-
onSubscribe
public final void onSubscribe(org.reactivestreams.Subscription s)
- Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<T>
-
onNext
public final void onNext(T t)
- Specified by:
onNextin interfaceorg.reactivestreams.Subscriber<T>
-
onError
public final void onError(java.lang.Throwable t)
- Specified by:
onErrorin interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public final void onComplete()
- Specified by:
onCompletein interfaceorg.reactivestreams.Subscriber<T>
-
-