Class S3CrtResponseTransformerProvider
-
Method Summary
Modifier and TypeMethodDescriptionCreates a transformer that returns the response body as a blockingResponseInputStreamthat reads directly from the client's direct buffer pool.
-
Method Details
-
toBlockingInputStreamFromDirectBufferPool
public static AsyncResponseTransformer<GetObjectResponse,ResponseInputStream<GetObjectResponse>> toBlockingInputStreamFromDirectBufferPool()Creates a transformer that returns the response body as a blockingResponseInputStreamthat reads directly from the client's direct buffer pool. UnlikeAsyncResponseTransformer.toBlockingInputStream(), the client does not copy each downloaded part into a new heap array. Reading into the caller's array still copies.For a
GetObjectrequest that setspartNumber, the response does not consume pool capacity.Pass this transformer directly to
getObjecton anS3AsyncClientcreated byS3AsyncClient.crtBuilder()with a direct buffer pool configured throughS3CrtAsyncClientBuilder.directBufferPoolConfiguration(software.amazon.awssdk.services.s3.crt.S3CrtDirectBufferPoolConfiguration). On any other client, or if it is wrapped in another transformer, the request fails before it is sent.The future returned by
getObjectcompletes when the response stream is ready. The transformer can be reused acrossgetObjectcalls.Read the stream to the end. A failure after the stream is returned, including a full-object checksum mismatch, is thrown by
read.Always close the response stream. Closing releases unread buffers, which other requests on the client can't use until then, and cancels any remaining download work.
Concurrent downloads that share a direct buffer pool can stall if the pool is too small. See
S3CrtDirectBufferPoolConfigurationfor how to size it.ExecutionInterceptor.modifyAsyncHttpResponseContentis not applied to the object body. Don't use this transformer if an interceptor must transform object bytes.To download through a transfer manager, pass this transformer unwrapped to
S3TransferManager.download.- Returns:
- a transformer that produces a blocking response stream
-