Class InputStreamResponseTransformer<ResponseT extends SdkResponse>
- java.lang.Object
-
- software.amazon.awssdk.core.internal.async.InputStreamResponseTransformer<ResponseT>
-
- All Implemented Interfaces:
AsyncResponseTransformer<ResponseT,ResponseInputStream<ResponseT>>
public class InputStreamResponseTransformer<ResponseT extends SdkResponse> extends Object implements AsyncResponseTransformer<ResponseT,ResponseInputStream<ResponseT>>
AAsyncResponseTransformer
that allows performing blocking reads on the response data.Created with
AsyncResponseTransformer.toBlockingInputStream()
.
-
-
Constructor Summary
Constructors Constructor Description InputStreamResponseTransformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exceptionOccurred(Throwable error)
Called when an error is encountered while making the request or receiving the response.void
onResponse(ResponseT response)
Called when the unmarshalled response object is ready.void
onStream(SdkPublisher<ByteBuffer> publisher)
Called when the response stream is ready.CompletableFuture<ResponseInputStream<ResponseT>>
prepare()
Initial call to enable any setup required before the response is handled.
-
-
-
Method Detail
-
prepare
public CompletableFuture<ResponseInputStream<ResponseT>> prepare()
Description copied from interface:AsyncResponseTransformer
Initial call to enable any setup required before the response is handled.Note that this will be called for each request attempt, up to the number of retries allowed by the configured
RetryPolicy
.This method is guaranteed to be called before the request is executed, and before
AsyncResponseTransformer.onResponse(Object)
is signaled.- Specified by:
prepare
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,ResponseInputStream<ResponseT extends SdkResponse>>
- Returns:
- The future holding the transformed response.
-
onResponse
public void onResponse(ResponseT response)
Description copied from interface:AsyncResponseTransformer
Called when the unmarshalled response object is ready.- Specified by:
onResponse
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,ResponseInputStream<ResponseT extends SdkResponse>>
- Parameters:
response
- The unmarshalled response.
-
onStream
public void onStream(SdkPublisher<ByteBuffer> publisher)
Description copied from interface:AsyncResponseTransformer
Called when the response stream is ready.- Specified by:
onStream
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,ResponseInputStream<ResponseT extends SdkResponse>>
- Parameters:
publisher
- The publisher.
-
exceptionOccurred
public void exceptionOccurred(Throwable error)
Description copied from interface:AsyncResponseTransformer
Called when an error is encountered while making the request or receiving the response. Implementations should free up any resources in this method. This method may be called multiple times during the lifecycle of a request if automatic retries are enabled.- Specified by:
exceptionOccurred
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,ResponseInputStream<ResponseT extends SdkResponse>>
- Parameters:
error
- Error that occurred.
-
-