2

How can a plain InputStream be created using the S3AsyncClient for a getObject request?

The S3AsyncClient for AWS JDK 2.0 does not seem to have a function that returns a ResponseInputStream<GetObjectResponse> the same way that the S3Client synchronous client does.

The only return type available is a CompletableFuture<GetObjectResponse>, but the methods returning that type assume that the data is going to a local path.

S3AsyncClient s3AsyncClient = ...;


CompletableFuture<GetObjectResponse> response = s3AsyncClient.getObject(
    GetObjectRequest.builder()
            .bucket(bucket)
            .key(key)
            .build(),
    path));    

There is a similar stackoverflow item, but the question and answer both utilize the synchronous S3Client.

Thank you in advance for your consideration and response.

Ramón J Romero y Vigil
  • 16,344
  • 6
  • 69
  • 108

0 Answers0