Package io.micronaut.http.body
Class InternalByteBody
java.lang.Object
io.micronaut.http.body.InternalByteBody
- All Implemented Interfaces:
ByteBody
- Direct Known Subclasses:
AvailableByteArrayBody,BaseStreamingByteBody,InputStreamByteBody
Internal extensions of
ByteBody.- Since:
- 4.5.0
-
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 anCompletableFuturethat will complete when all bytes are available, or an error occurs.abstract @NonNull io.micronaut.core.execution.ExecutionFlow<? extends CloseableAvailableByteBody> Variant ofbuffer()that uses theExecutionFlowAPI for extra efficiency.static io.micronaut.core.execution.ExecutionFlow<? extends CloseableAvailableByteBody> bufferFlow(ByteBody body) protected final voidThrow the standard "already claimed" error and attach stored traces when tracking is enabled.protected final voidRecord the first close location, if tracking is enabled.protected final voidRecord the first primary operation location, if tracking is enabled.@NonNull org.reactivestreams.Publisher<byte[]> Get this body as a reactive stream of byte arrays.abstract @NonNull org.reactivestreams.Publisher<io.micronaut.core.io.buffer.ReadBuffer> Get this body as a reactive stream ofReadBuffers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
@NonNull public abstract @NonNull io.micronaut.core.execution.ExecutionFlow<? extends CloseableAvailableByteBody> bufferFlow()Variant ofbuffer()that uses theExecutionFlowAPI for extra efficiency.- Returns:
- A flow that completes when all bytes are available
-
buffer
Description copied from interface:ByteBodyBuffer the full body and return anCompletableFuturethat 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
@NonNull public @NonNull org.reactivestreams.Publisher<byte[]> toByteArrayPublisher()Description copied from interface:ByteBodyGet 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:
toByteArrayPublisherin interfaceByteBody- Returns:
- The streamed bytes
-
toReadBufferPublisher
@NonNull public abstract @NonNull org.reactivestreams.Publisher<io.micronaut.core.io.buffer.ReadBuffer> toReadBufferPublisher()Description copied from interface:ByteBodyGet this body as a reactive stream ofReadBuffers. 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:
toReadBufferPublisherin 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
public static io.micronaut.core.execution.ExecutionFlow<? extends CloseableAvailableByteBody> bufferFlow(ByteBody body)
-