Class InternalByteBody

java.lang.Object
io.micronaut.http.body.InternalByteBody
All Implemented Interfaces:
ByteBody
Direct Known Subclasses:
AvailableByteArrayBody, AvailableNettyByteBody, BaseStreamingByteBody, InputStreamByteBody

@Internal public abstract class InternalByteBody extends Object implements ByteBody
Internal extensions of ByteBody.
Since:
4.5.0
Author:
Jonas Konrad
  • 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 ExecutionFlow<? extends CloseableAvailableByteBody> bufferFlow()
      Variant of buffer() that uses the ExecutionFlow API for extra efficiency.
      Returns:
      A flow that completes when all bytes are available
    • buffer

      public final CompletableFuture<? extends CloseableAvailableByteBody> buffer()
      Description copied from interface: ByteBody
      Buffer the full body and return an CompletableFuture 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.

      Specified by:
      buffer in interface ByteBody
      Returns:
      A future that completes when all bytes are available
    • toByteArrayPublisher

      @NonNull public @NonNull Publisher<byte[]> 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 interface ByteBody
      Returns:
      The streamed bytes
    • toReadBufferPublisher

      @NonNull public abstract @NonNull Publisher<ReadBuffer> toReadBufferPublisher()
      Description copied from interface: ByteBody
      Get this body as a reactive stream of ReadBuffers. 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 interface ByteBody
      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 ExecutionFlow<? extends CloseableAvailableByteBody> bufferFlow(ByteBody body)