Interface CloseableByteBody

All Superinterfaces:
AutoCloseable, ByteBody, Closeable
All Known Subinterfaces:
CloseableAvailableByteBody
All Known Implementing Classes:
AvailableNettyByteBody, StreamingNettyByteBody

public interface CloseableByteBody extends ByteBody, Closeable
A Closeable version of ByteBody. close() releases any resources that may still be held. No other operations on this body are valid after close(), but multiple calls to close() are allowed (though only the first will do anything). If a primary operation (see ByteBody) is performed on this body, you can but do not need to close it anymore. Closing becomes a no-op in that case.
Since:
4.5.0
Author:
Jonas Konrad
  • Method Details

    • allowDiscard

      @NonNull default @NonNull CloseableByteBody allowDiscard()
      Description copied from interface: ByteBody
      Signal 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:
      allowDiscard in interface ByteBody
      Returns:
      This body
    • close

      void close()
      Clean up any resources held by this instance. See class documentation.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable