Class AvailableNettyByteBody

java.lang.Object
io.micronaut.http.body.InternalByteBody
io.micronaut.http.netty.body.AvailableNettyByteBody
All Implemented Interfaces:
AvailableByteBody, ByteBody, CloseableAvailableByteBody, CloseableByteBody, Closeable, AutoCloseable

@Internal @Deprecated(since="4.10.0", forRemoval=true) public final class AvailableNettyByteBody extends InternalByteBody implements CloseableAvailableByteBody
Deprecated, for removal: This API element is subject to removal in a future version.
Netty ByteBuf implementation of ImmediateByteBody.
Since:
4.5.0
Author:
Jonas Konrad
  • Constructor Details

    • AvailableNettyByteBody

      public AvailableNettyByteBody(@NonNull io.netty.buffer.ByteBuf buffer)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • empty

      public static CloseableAvailableByteBody empty()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • toByteBuf

      public static @NonNull io.netty.buffer.ByteBuf toByteBuf(@NonNull AvailableByteBody body)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • createChecked

      public static @NonNull CloseableByteBody createChecked(@NonNull io.netty.channel.EventLoop loop, @NonNull BodySizeLimits bodySizeLimits, @NonNull io.netty.buffer.ByteBuf buf)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This is a wrapper around AvailableNettyByteBody(ByteBuf) with an extra body length check.
      Parameters:
      loop - The event loop for constructing StreamingNettyByteBody
      bodySizeLimits - The body size limits to check
      buf - The input buffer
      Returns:
      The body with the given input buffer, or a StreamingNettyByteBody with the appropriate content length error
    • peek

      public io.netty.buffer.ByteBuf peek()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • toInputStream

      public @NonNull InputStream toInputStream()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: ByteBody
      Get this body as an InputStream.

      This is a primary operation. After this operation, no other primary operation or ByteBody.split() may be done.

      Specified by:
      toInputStream in interface AvailableByteBody
      Specified by:
      toInputStream in interface ByteBody
      Returns:
      The streamed bytes
    • length

      public long length()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AvailableByteBody
      The length in bytes of the body.
      Specified by:
      length in interface AvailableByteBody
      Returns:
      The length
      See Also:
    • bufferFlow

      public @NonNull ExecutionFlow<? extends CloseableAvailableByteBody> bufferFlow()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: InternalByteBody
      Variant of InternalByteBody.buffer() that uses the ExecutionFlow API for extra efficiency.
      Specified by:
      bufferFlow in class InternalByteBody
      Returns:
      A flow that completes when all bytes are available
    • close

      public void close()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: CloseableByteBody
      Clean up any resources held by this instance. See class documentation.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface CloseableByteBody
    • toReadBufferPublisher

      public @NonNull Publisher<ReadBuffer> toReadBufferPublisher()
      Deprecated, for removal: This API element is subject to removal in a future version.
      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 AvailableByteBody
      Specified by:
      toReadBufferPublisher in interface ByteBody
      Specified by:
      toReadBufferPublisher in class InternalByteBody
      Returns:
      The streamed bytes
    • toByteArray

      public byte @NonNull [] toByteArray()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AvailableByteBody
      Get this body as a byte array.

      This is a primary operation. After this operation, no other primary operation or AvailableByteBody.split() may be done.

      Specified by:
      toByteArray in interface AvailableByteBody
      Returns:
      The bytes
    • toByteBuffer

      public @NonNull ByteBuffer<?> toByteBuffer()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AvailableByteBody
      Get this body as a ByteBuffer. Note that the buffer may be reference counted, and the caller must take care of releasing it.

      This is a primary operation. After this operation, no other primary operation or AvailableByteBody.split() may be done.

      Specified by:
      toByteBuffer in interface AvailableByteBody
      Returns:
      The bytes
    • move

      public @NonNull CloseableByteBody move()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: ByteBody
      Create a new CloseableByteBody with 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 ByteBody for example, it will have no impact on the new CloseableByteBody that the receiver is working with.

      Specified by:
      move in interface ByteBody
      Returns:
      A new CloseableByteBody with the same content.
    • toString

      public @NonNull String toString(Charset charset)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AvailableByteBody
      Convert this body to a string with the given charset.

      This is a primary operation. After this operation, no other primary operation or AvailableByteBody.split() may be done.

      Specified by:
      toString in interface AvailableByteBody
      Parameters:
      charset - The charset to convert the body
      Returns:
      The body as a string
    • split

      public @NonNull CloseableAvailableByteBody split()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AvailableByteBody
      For immediate buffers, backpressure is not relevant, so the backpressure modes passed to AvailableByteBody.split(SplitBackpressureMode) are ignored. You can use this method always.
      Specified by:
      split in interface AvailableByteBody
      Specified by:
      split in interface ByteBody
      Returns:
      A body with the same content as this one
      See Also:
    • touch

      public void touch()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: ByteBody
      Debug trace for leak detection.
      Specified by:
      touch in interface ByteBody