Class S3CrtResponseTransformerProvider

java.lang.Object
software.amazon.awssdk.services.s3.crt.S3CrtResponseTransformerProvider

@SdkPublicApi public final class S3CrtResponseTransformerProvider extends Object
Provides CRT-specific S3 asynchronous response transformers.
  • Method Details

    • toBlockingInputStreamFromDirectBufferPool

      public static AsyncResponseTransformer<GetObjectResponse,ResponseInputStream<GetObjectResponse>> toBlockingInputStreamFromDirectBufferPool()
      Creates a transformer that returns the response body as a blocking ResponseInputStream that reads directly from the client's direct buffer pool. Unlike AsyncResponseTransformer.toBlockingInputStream(), the client does not copy each downloaded part into a new heap array. Reading into the caller's array still copies.

      For a GetObject request that sets partNumber, the response does not consume pool capacity.

      Pass this transformer directly to getObject on an S3AsyncClient created by S3AsyncClient.crtBuilder() with a direct buffer pool configured through S3CrtAsyncClientBuilder.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 getObject completes when the response stream is ready. The transformer can be reused across getObject calls.

      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 S3CrtDirectBufferPoolConfiguration for how to size it.

      ExecutionInterceptor.modifyAsyncHttpResponseContent is 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