Class ReactiveByteBufferByteBody.SharedBuffer
java.lang.Object
io.micronaut.http.body.stream.BaseSharedBuffer
io.micronaut.http.body.ReactiveByteBufferByteBody.SharedBuffer
- All Implemented Interfaces:
BufferConsumer
- Enclosing class:
ReactiveByteBufferByteBody
public static final class ReactiveByteBufferByteBody.SharedBuffer
extends BaseSharedBuffer
implements BufferConsumer
Simple implementation of
Buffering is done using a
BaseSharedBuffer that consumes ByteBuffers.Buffering is done using a
ByteArrayOutputStream. Concurrency control is done through
a non-reentrant lock based on AtomicReference.- Since:
- 4.8.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseSharedBuffer
BaseSharedBuffer.AsFlux, BaseSharedBuffer.IncorrectContentLengthExceptionNested classes/interfaces inherited from interface BufferConsumer
BufferConsumer.Upstream -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ReadBuffer rb) Add a given buffer to thisBaseSharedBuffer.
Not thread safe, caller must handle concurrency.voidAdd a given buffer to thisBaseSharedBufferand complete it, in one operation.voidcomplete()Implementation ofBufferConsumer.complete().
Not thread safe, caller must handle concurrency.voidImplementation ofBufferConsumer.error(Throwable).
Not thread safe, caller must handle concurrency.subscribeFull(BufferConsumer.Upstream specificUpstream) Methods inherited from class BaseSharedBuffer
addGuarded, addSizeLimitTrackers, afterSubscribe, getExpectedLength, getRootUpstream, logClaim, reserve0, setExpectedLength, setExpectedLengthFrom, subscribe0, subscribeFull0Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BufferConsumer
discard
-
Method Details
-
subscribeFull
-
add
Description copied from class:BaseSharedBufferAdd a given buffer to thisBaseSharedBuffer.
Not thread safe, caller must handle concurrency.- Specified by:
addin interfaceBufferConsumer- Overrides:
addin classBaseSharedBuffer- Parameters:
rb- The buffer
-
addAndComplete
Description copied from class:BaseSharedBufferAdd a given buffer to thisBaseSharedBufferand complete it, in one operation. This allows subscribers that implementBufferConsumer.addAndComplete(ReadBuffer)to combine the final bytes and the completion signal into a single downstream message.
Not thread safe, caller must handle concurrency.- Specified by:
addAndCompletein interfaceBufferConsumer- Overrides:
addAndCompletein classBaseSharedBuffer- Parameters:
rb- The final buffer
-
error
Description copied from class:BaseSharedBufferImplementation ofBufferConsumer.error(Throwable).
Not thread safe, caller must handle concurrency.- Specified by:
errorin interfaceBufferConsumer- Overrides:
errorin classBaseSharedBuffer- Parameters:
e- The error
-
complete
public void complete()Description copied from class:BaseSharedBufferImplementation ofBufferConsumer.complete().
Not thread safe, caller must handle concurrency.- Specified by:
completein interfaceBufferConsumer- Overrides:
completein classBaseSharedBuffer
-