Package io.micronaut.http.body
Class InternalByteBody
java.lang.Object
io.micronaut.http.body.InternalByteBody
- All Implemented Interfaces:
ByteBody
- Direct Known Subclasses:
AvailableByteArrayBody
,AvailableNettyByteBody
,BaseStreamingByteBody
,InputStreamByteBody
Internal extensions of
ByteBody
.- Since:
- 4.5.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.http.body.ByteBody
ByteBody.BodyDiscardedException, ByteBody.SplitBackpressureMode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal CompletableFuture<? extends CloseableAvailableByteBody>
buffer()
Buffer the full body and return anCompletableFuture
that will complete when all bytes are available, or an error occurs.abstract @NonNull ExecutionFlow<? extends CloseableAvailableByteBody>
Variant ofbuffer()
that uses theExecutionFlow
API for extra efficiency.static ExecutionFlow<? extends CloseableAvailableByteBody>
bufferFlow
(ByteBody body) protected final void
Throw the standard "already claimed" error and attach stored traces when tracking is enabled.protected final void
Record the first close location, if tracking is enabled.protected final void
Record the first primary operation location, if tracking is enabled.Get this body as a reactive stream of byte arrays.abstract @NonNull Publisher<ReadBuffer>
Get this body as a reactive stream ofReadBuffer
s.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.ByteBody
allowDiscard, expectedLength, move, split, split, toByteBufferPublisher, toInputStream, touch
-
Constructor Details
-
InternalByteBody
public InternalByteBody()
-
-
Method Details
-
recordPrimaryOp
protected final void recordPrimaryOp()Record the first primary operation location, if tracking is enabled. -
recordClosed
protected final void recordClosed()Record the first close location, if tracking is enabled. -
bufferFlow
Variant ofbuffer()
that uses theExecutionFlow
API for extra efficiency.- Returns:
- A flow that completes when all bytes are available
-
buffer
Description copied from interface:ByteBody
Buffer the full body and return anCompletableFuture
that will complete when all bytes are available, or an error occurs.This is a primary operation. After this operation, no other primary operation or
ByteBody.split()
may be done. -
toByteArrayPublisher
Description copied from interface:ByteBody
Get this body as a reactive stream of byte arrays.This is a primary operation. After this operation, no other primary operation or
ByteBody.split()
may be done.- Specified by:
toByteArrayPublisher
in interfaceByteBody
- Returns:
- The streamed bytes
-
toReadBufferPublisher
Description copied from interface:ByteBody
Get this body as a reactive stream ofReadBuffer
s. Note that the caller must take care to release the returned buffers.This is a primary operation. After this operation, no other primary operation or
ByteBody.split()
may be done.- Specified by:
toReadBufferPublisher
in interfaceByteBody
- Returns:
- The streamed bytes
-
failClaim
@Contract("-> fail") protected final void failClaim()Throw the standard "already claimed" error and attach stored traces when tracking is enabled. -
bufferFlow
-