Class StreamingNettyByteBody
- All Implemented Interfaces:
- ByteBody,- CloseableByteBody,- InternalByteBody,- Closeable,- AutoCloseable
- Since:
- 4.5.0
- Author:
- Jonas Konrad
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classThis class buffers input data and distributes it to multipleStreamingNettyByteBodyinstances.Nested classes/interfaces inherited from interface io.micronaut.http.body.ByteBodyByteBody.BodyDiscardedException, ByteBody.SplitBackpressureMode
- 
Field SummaryFields inherited from class io.micronaut.http.netty.body.NettyByteBodyLOG
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionSignal that the upstream may discard any remaining body data.@NonNull ExecutionFlow<? extends CloseableAvailableByteBody>Variant ofInternalByteBody.buffer()that uses theExecutionFlowAPI for extra efficiency.voidclose()Clean up any resources held by this instance.Get the expected length of this body, if known (either fromContent-Lengthor from previous buffering).move()Create a newCloseableByteBodywith the same content but an independent lifecycle, claiming this body in the process.primary(ByteBufConsumer primary) split(@NonNull ByteBody.SplitBackpressureMode backpressureMode) Create a new, independentByteBodythat contains the same data as this one.protected reactor.core.publisher.Flux<io.netty.buffer.ByteBuf>Get this body as anInputStream.Methods inherited from class io.micronaut.http.netty.body.NettyByteBodytoByteArrayPublisher, toByteBufferPublisher, toByteBufsMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.body.ByteBodysplit, toByteArrayPublisher, toByteBufferPublisherMethods inherited from interface io.micronaut.http.body.InternalByteBodybuffer
- 
Constructor Details
- 
Method Details- 
- 
split@NonNull public @NonNull CloseableByteBody split(@NonNull @NonNull ByteBody.SplitBackpressureMode backpressureMode) Description copied from interface:ByteBodyCreate a new, independentByteBodythat contains the same data as this one.- Specified by:
- splitin interface- ByteBody
- Parameters:
- backpressureMode- How to handle backpressure between the old and new body. See- ByteBody.SplitBackpressureModedocumentation
- Returns:
- The newly split body. Must be closed by the caller, unless a terminal operation is performed on it
 
- 
allowDiscardDescription copied from interface:ByteBodySignal that the upstream may discard any remaining body data. Only if all consumers of the body allow discarding will the body be discarded, otherwise it will still be sent to all consumers. It is an optional operation.Discarding may be implemented e.g. by closing the input side of an HTTP/2 stream. This method must be called before any primary operation. - Specified by:
- allowDiscardin interface- ByteBody
- Specified by:
- allowDiscardin interface- CloseableByteBody
- Returns:
- This body
 
- 
toByteBufPublisherprotected reactor.core.publisher.Flux<io.netty.buffer.ByteBuf> toByteBufPublisher()
- 
expectedLengthDescription copied from interface:ByteBodyGet the expected length of this body, if known (either fromContent-Lengthor from previous buffering). The actual length will never exceed this value, though it may sometimes be lower if there is a connection error.This value may go from OptionalLong.empty()to a known value over the lifetime of this body.This is not a primary operation and does not modify this ByteBody.- Specified by:
- expectedLengthin interface- ByteBody
- Returns:
- The expected length of this body
 
- 
toInputStreamDescription copied from interface:ByteBodyGet this body as anInputStream.This is a primary operation. After this operation, no other primary operation or ByteBody.split()may be done.- Specified by:
- toInputStreamin interface- ByteBody
- Returns:
- The streamed bytes
 
- 
bufferFlowDescription copied from interface:InternalByteBodyVariant ofInternalByteBody.buffer()that uses theExecutionFlowAPI for extra efficiency.- Specified by:
- bufferFlowin interface- InternalByteBody
- Specified by:
- bufferFlowin class- NettyByteBody
- Returns:
- A flow that completes when all bytes are available
 
- 
moveDescription copied from interface:ByteBodyCreate a newCloseableByteBodywith the same content but an independent lifecycle, claiming this body in the process.This is a primary operation. After this operation, no other primary operation or ByteBody.split()may be done.The purpose of this method is to move the data to a different component in an application, making clear that the receiving component claims ownership of the body. If the sending component then closes the original ByteBodyfor example, it will have no impact on the newCloseableByteBodythat the receiver is working with.- Specified by:
- movein interface- ByteBody
- Returns:
- A new CloseableByteBodywith the same content.
 
- 
closepublic void close()Description copied from interface:CloseableByteBodyClean up any resources held by this instance. See class documentation.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- CloseableByteBody
 
 
-