Class BlockingInputStreamAsyncRequestBody
java.lang.Object
software.amazon.awssdk.core.async.BlockingInputStreamAsyncRequestBody
- All Implemented Interfaces:
org.reactivestreams.Publisher<ByteBuffer>
,AsyncRequestBody
,SdkPublisher<ByteBuffer>
An implementation of
AsyncRequestBody
that allows performing a blocking write of an input stream to a downstream
service.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a default builder forBlockingInputStreamAsyncRequestBody
.void
cancel()
Cancel any running write (and mark the stream as failed).void
subscribe
(org.reactivestreams.Subscriber<? super ByteBuffer> s) long
writeInputStream
(InputStream inputStream) Block the calling thread and write the provided input stream to the downstream service.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.awssdk.core.async.AsyncRequestBody
split, split
Methods inherited from interface software.amazon.awssdk.core.async.SdkPublisher
addTrailingData, buffer, doAfterOnCancel, doAfterOnComplete, doAfterOnError, filter, filter, flatMapIterable, limit, map, subscribe
-
Method Details
-
builder
Creates a default builder forBlockingInputStreamAsyncRequestBody
. -
contentLength
- Specified by:
contentLength
in interfaceAsyncRequestBody
- Returns:
- The content length of the data being produced.
-
contentType
- Specified by:
contentType
in interfaceAsyncRequestBody
- Returns:
- The content type of the data being produced.
-
writeInputStream
Block the calling thread and write the provided input stream to the downstream service.This method will block the calling thread immediately. This means that this request body should usually be passed to the SDK before this method is called.
This method will return the amount of data written when the entire input stream has been written. This will throw an exception if writing the input stream has failed.
You can invoke
cancel()
to cancel any blocked write calls to the downstream service (and mark the stream as failed). -
cancel
public void cancel()Cancel any running write (and mark the stream as failed). -
subscribe
- Specified by:
subscribe
in interfaceorg.reactivestreams.Publisher<ByteBuffer>
-