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 ofAsyncRequestBody
that allows performing a blocking write of an output stream to a downstream service.The caller is responsible for calling
OutputStream.close()
on theoutputStream()
when writing is complete.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Long>
contentLength()
CancellableOutputStream
outputStream()
Return an output stream to which blocking writes can be made to the downstream service.void
subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.core.async.AsyncRequestBody
contentType, split, split
-
Methods inherited from interface software.amazon.awssdk.core.async.SdkPublisher
addTrailingData, buffer, doAfterOnCancel, doAfterOnComplete, doAfterOnError, filter, filter, flatMapIterable, limit, map, subscribe
-
-
-
-
Method Detail
-
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).
-
contentLength
public Optional<Long> contentLength()
- Specified by:
contentLength
in interfaceAsyncRequestBody
- Returns:
- The content length of the data being produced.
-
subscribe
public void subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s)
- Specified by:
subscribe
in interfaceorg.reactivestreams.Publisher<ByteBuffer>
-
-