Class BlockingOutputStreamAsyncRequestBody

java.lang.Object
software.amazon.awssdk.core.async.BlockingOutputStreamAsyncRequestBody
All Implemented Interfaces:
org.reactivestreams.Publisher<ByteBuffer>, AsyncRequestBody, SdkPublisher<ByteBuffer>

public final class BlockingOutputStreamAsyncRequestBody extends Object implements AsyncRequestBody
An implementation of AsyncRequestBody that allows performing a blocking write of an output stream to a downstream service.

The caller is responsible for calling OutputStream.close() on the outputStream() when writing is complete.

See Also:
  • Method Details

    • outputStream

      public CancellableOutputStream outputStream()
      Return an output stream to which blocking writes can be made to the downstream service.

      This method will block the calling thread until the SDK is connected to the service. This means that this request body should usually be passed to the SDK before this method is called.

      You can invoke CancellableOutputStream.cancel() to cancel any blocked write calls to the downstream service (and mark the stream as failed).

    • builder

      Creates a default builder for BlockingOutputStreamAsyncRequestBody.
    • contentLength

      public Optional<Long> contentLength()
      Specified by:
      contentLength in interface AsyncRequestBody
      Returns:
      The content length of the data being produced.
    • subscribe

      public void subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s)
      Specified by:
      subscribe in interface org.reactivestreams.Publisher<ByteBuffer>
    • body

      public String body()
      Description copied from interface: AsyncRequestBody
      Each AsyncRequestBody should return a well-formed name that can be used to identify the implementation. The body name should only include alphanumeric characters.
      Specified by:
      body in interface AsyncRequestBody
      Returns:
      String containing the identifying name of this AsyncRequestBody implementation.