Package software.amazon.awssdk.crt.s3
Interface S3MetaRequestResponseHandler
-
public interface S3MetaRequestResponseHandler
Interface called by native code to provide S3MetaRequest responses.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
onFinished(S3FinishedResponseContext context)
Invoked when the entire meta request execution is complete.default void
onProgress(S3MetaRequestProgress progress)
Invoked to report progress of the meta request execution.default int
onResponseBody(ByteBuffer bodyBytesIn, long objectRangeStart, long objectRangeEnd)
Invoked to provide the response body as it is received.default void
onResponseHeaders(int statusCode, HttpHeader[] headers)
Invoked to provide response headers received during the execution of the meta request.
-
-
-
Method Detail
-
onResponseHeaders
default void onResponseHeaders(int statusCode, HttpHeader[] headers)
Invoked to provide response headers received during the execution of the meta request. Note: the statusCode in this callback is not the final statusCode. It is possible that the statusCode in `onResponseHeaders` is 200, and then the request fail leading to a different statusCode in the final `onFinished` callback.- Parameters:
statusCode
- statusCode of the HTTP responseheaders
- the headers received
-
onResponseBody
default int onResponseBody(ByteBuffer bodyBytesIn, long objectRangeStart, long objectRangeEnd)
Invoked to provide the response body as it is received.Note that if the client was created with
If backpressure is disabled, you do not need to maintain the flow-control window, data will arrive as fast as possible.S3ClientOptions.withReadBackpressureEnabled(boolean)
set true, you must maintain the flow-control window. The flow-control window shrinks as you receive body data via this callback. Whenever the flow-control window reaches zero, data will stop downloading. To keep data flowing, you must increment the window by returning a number from this method, or by callingS3MetaRequest.incrementReadWindow(long)
.- Parameters:
bodyBytesIn
- The body data for this chunk of the objectobjectRangeStart
- The byte index of the object that this refers to. For example, for an HTTP message that has a range header, the first chunk received will have a range_start that matches the range header's range-startobjectRangeEnd
- corresponds to the past-of-end chunk offset, i.e. objectRangeStart + the chunk length- Returns:
- The number of bytes to increment the flow-control window by
(calling
S3MetaRequest.incrementReadWindow(long)
has the same effect). This value is ignored if backpressure is disabled. - See Also:
S3ClientOptions.withReadBackpressureEnabled(boolean)
-
onFinished
default void onFinished(S3FinishedResponseContext context)
Invoked when the entire meta request execution is complete.- Parameters:
context
- a wrapper object containing the following fields
-
onProgress
default void onProgress(S3MetaRequestProgress progress)
Invoked to report progress of the meta request execution. The meaning of "progress" depends on theS3MetaRequestOptions.MetaRequestType
. For PUT_OBJECT, it refers to bytes uploaded. For COPY_OBJECT, it refers to bytes copied. For GET_OBJECT, it refers to bytes downloaded. For anything else, it refers to response body bytes received.- Parameters:
progress
- information about the progress of the meta request execution
-
-