Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/next-release/feature-AWSSDKforJavav2-d4e19d2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "feature",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Avoid extra byte array copying when downloading to memory with AsyncResponseTransformer"
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public final class ByteArrayAsyncResponseTransformer<ResponseT> implements
@Override
public CompletableFuture<ResponseBytes<ResponseT>> prepare() {
cf = new CompletableFuture<>();
return cf.thenApply(arr -> ResponseBytes.fromByteArray(response, arr));
// Using fromByteArrayUnsafe() to avoid unnecessary extra copying of byte array. The data writing has completed and the
// byte array will not be further modified so this is safe
return cf.thenApply(arr -> ResponseBytes.fromByteArrayUnsafe(response, arr));
}

@Override
Expand Down
Loading