In AWS Java SDK 1.x, I could get an S3Object
from an S3Client
like this.
S3Object obj = mS3Client.getObject(pBucket, pKey);
I'm trying to replicate that functionality using AWS Java SDK 2.0 (and end up with an S3Object
), but the closest I can get is a GetObjectResponse
, and I can't find any simple method calls to turn the response into an S3Object
.
GetObjectResponse response = mS3Client.getObject(
GetObjectRequest.builder()
.bucket(pBucket)
.key(pKey)
.build())
.response();
How can I get an S3Object
from the 2.0 S3Client
, or build one from the GetObjectResponse
?
InputStream
toString
, see https://mcmap.net/q/36074/-how-do-i-read-convert-an-inputstream-into-a-string-in-java/150884 – Hypethral