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.JsonByteBufferConcatenatingSubscriber
Nested classes/interfaces inherited from interface io.micronaut.http.body.stream.BufferConsumer
BufferConsumer.Upstream
-
Method Summary
Modifier and TypeMethodDescriptionstatic CloseableByteBody
concatenateJson
(Publisher<ByteBody> publisher) protected long
emitFinalSeparator
(boolean first) Called before after allByteBody
components to emit additional trailing bytes.protected long
emitLeadingSeparator
(boolean first) Called before any newByteBody
component to emit an additional separator.Methods inherited from class io.micronaut.http.body.ConcatenatingSubscriber.ByteBufferConcatenatingSubscriber
add, concatenate, forward, forwardComplete, forwardError
Methods inherited from class io.micronaut.http.body.ConcatenatingSubscriber
allowDiscard, complete, disregardBackpressure, error, onBytesConsumed, onComplete, onError, onForward, onNext, onSubscribe, start
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.stream.BufferConsumer
complete, discard, error
Methods inherited from interface reactor.core.CoreSubscriber
currentContext
-
Method Details
-
concatenateJson
-
emitLeadingSeparator
protected long emitLeadingSeparator(boolean first) Description copied from class:ConcatenatingSubscriber
Called before any newByteBody
component to emit an additional separator.- Overrides:
emitLeadingSeparator
in classConcatenatingSubscriber
- Parameters:
first
-true
iff 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:ConcatenatingSubscriber
Called before after allByteBody
components to emit additional trailing bytes.- Overrides:
emitFinalSeparator
in classConcatenatingSubscriber
- Parameters:
first
-true
iff this is the first element, i.e. there were no componentByteBody
s- Returns:
- The number of bytes written for
ConcatenatingSubscriber.onBytesConsumed(long)
accounting
-