ResponseT
- Pojo response type.public final class ByteArrayAsyncResponseTransformer<ResponseT> extends Object implements AsyncResponseTransformer<ResponseT,ResponseBytes<ResponseT>>
AsyncResponseTransformer
that dumps content into a byte array and supports further
conversions into types, like strings.
This can be created with static methods on AsyncResponseTransformer
.AsyncResponseTransformer.toBytes()
Constructor and Description |
---|
ByteArrayAsyncResponseTransformer() |
Modifier and Type | Method and Description |
---|---|
void |
exceptionOccurred(Throwable throwable)
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<ResponseBytes<ResponseT>> |
prepare()
Initial call to enable any setup required before the response is handled.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toBytes, toFile, toFile
public CompletableFuture<ResponseBytes<ResponseT>> prepare()
AsyncResponseTransformer
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.
prepare
in interface AsyncResponseTransformer<ResponseT,ResponseBytes<ResponseT>>
public void onResponse(ResponseT response)
AsyncResponseTransformer
onResponse
in interface AsyncResponseTransformer<ResponseT,ResponseBytes<ResponseT>>
response
- The unmarshalled response.public void onStream(SdkPublisher<ByteBuffer> publisher)
AsyncResponseTransformer
onStream
in interface AsyncResponseTransformer<ResponseT,ResponseBytes<ResponseT>>
publisher
- The publisher.public void exceptionOccurred(Throwable throwable)
AsyncResponseTransformer
exceptionOccurred
in interface AsyncResponseTransformer<ResponseT,ResponseBytes<ResponseT>>
throwable
- Error that occurred.Copyright © 2021. All rights reserved.