Class ByteBufferRequestContent

All Implemented Interfaces:

public class ByteBufferRequestContent extends AbstractRequestContent

A Request.Content for ByteBuffers.

The position and limit of the ByteBuffers passed to the constructor are not modified; content production returns a slice of the original ByteBuffer.

  • Constructor Details

    • ByteBufferRequestContent

      public ByteBufferRequestContent(ByteBuffer... buffers)
    • ByteBufferRequestContent

      public ByteBufferRequestContent(String contentType, ByteBuffer... buffers)
  • Method Details

    • getLength

      public long getLength()
      the content length, if known, or -1 if the content length is unknown
    • isReproducible

      public boolean isReproducible()
      Description copied from interface: Request.Content

      Whether this content producer can produce exactly the same content more than once.

      Implementations should return true only if the content can be produced more than once, which means that Request.Content.subscribe(Consumer, boolean) may be called again.

      The HttpClient implementation may use this method in particular cases where it detects that it is safe to retry a request that failed.

      whether the content can be produced more than once
    • newSubscription

      protected Request.Content.Subscription newSubscription(Request.Content.Consumer consumer, boolean emitInitialContent)
      Specified by:
      newSubscription in class AbstractRequestContent