Package io.micronaut.http.body
Class ConcatenatingSubscriber.JsonByteBufferConcatenatingSubscriber
java.lang.Object
io.micronaut.http.body.ConcatenatingSubscriber
io.micronaut.http.body.ConcatenatingSubscriber.ByteBufferConcatenatingSubscriber
io.micronaut.http.body.ConcatenatingSubscriber.JsonByteBufferConcatenatingSubscriber
- All Implemented Interfaces:
BufferConsumer,BufferConsumer.Upstream,Subscriber<ByteBody>,reactor.core.CoreSubscriber<ByteBody>
- Enclosing class:
- ConcatenatingSubscriber
public static final class ConcatenatingSubscriber.JsonByteBufferConcatenatingSubscriber
extends ConcatenatingSubscriber.ByteBufferConcatenatingSubscriber
Concatenating implementation that writes to a
ReactiveByteBufferByteBody, with
JSON-style separators.-
Nested Class Summary
Nested classes/interfaces inherited from class io.micronaut.http.body.ConcatenatingSubscriber
ConcatenatingSubscriber.ByteBufferConcatenatingSubscriber, ConcatenatingSubscriber.JsonByteBufferConcatenatingSubscriberNested classes/interfaces inherited from interface io.micronaut.http.body.stream.BufferConsumer
BufferConsumer.Upstream -
Method Summary
Modifier and TypeMethodDescriptionstatic CloseableByteBodyconcatenateJson(Publisher<ByteBody> publisher) protected longemitFinalSeparator(boolean first) Called before after allByteBodycomponents to emit additional trailing bytes.protected longemitLeadingSeparator(boolean first) Called before any newByteBodycomponent to emit an additional separator.Methods inherited from class io.micronaut.http.body.ConcatenatingSubscriber.ByteBufferConcatenatingSubscriber
add, concatenate, forward, forwardComplete, forwardErrorMethods inherited from class io.micronaut.http.body.ConcatenatingSubscriber
allowDiscard, complete, disregardBackpressure, error, onBytesConsumed, onComplete, onError, onForward, onNext, onSubscribe, startMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.body.stream.BufferConsumer
complete, discard, errorMethods inherited from interface reactor.core.CoreSubscriber
currentContext
-
Method Details
-
concatenateJson
-
emitLeadingSeparator
protected long emitLeadingSeparator(boolean first) Description copied from class:ConcatenatingSubscriberCalled before any newByteBodycomponent to emit an additional separator.- Overrides:
emitLeadingSeparatorin classConcatenatingSubscriber- Parameters:
first-trueiff this is the first element (i.e. the start of the output)- Returns:
- The number of bytes written for
ConcatenatingSubscriber.onBytesConsumed(long)accounting
-
emitFinalSeparator
protected long emitFinalSeparator(boolean first) Description copied from class:ConcatenatingSubscriberCalled before after allByteBodycomponents to emit additional trailing bytes.- Overrides:
emitFinalSeparatorin classConcatenatingSubscriber- Parameters:
first-trueiff this is the first element, i.e. there were no componentByteBodys- Returns:
- The number of bytes written for
ConcatenatingSubscriber.onBytesConsumed(long)accounting
-