Skip to content

Commit 5c2f1c2

Browse files
committed
direct byte buf
1 parent d635179 commit 5c2f1c2

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/software/amazon/awssdk/crt/s3/S3MetaRequestResponseHandlerNativeAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class S3MetaRequestResponseHandlerNativeAdapter {
1515
this.responseHandler = responseHandler;
1616
}
1717

18-
int onResponseBody(byte[] bodyBytesIn, long objectRangeStart, long objectRangeEnd) {
19-
return this.responseHandler.onResponseBody(ByteBuffer.wrap(bodyBytesIn), objectRangeStart, objectRangeEnd);
18+
int onResponseBody(ByteBuffer bodyBytesIn, long objectRangeStart, long objectRangeEnd) {
19+
return this.responseHandler.onResponseBody(bodyBytesIn, objectRangeStart, objectRangeEnd);
2020
}
2121

2222
void onFinished(int errorCode, int responseStatus, byte[] errorPayload, String errorOperationName, int checksumAlgorithm, boolean didValidateChecksum, Throwable cause, final ByteBuffer headersBlob) {

src/native/java_class_ids.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ static void s_cache_s3_meta_request_response_handler_native_adapter_properties(J
723723
AWS_FATAL_ASSERT(cls);
724724

725725
s3_meta_request_response_handler_native_adapter_properties.onResponseBody =
726-
(*env)->GetMethodID(env, cls, "onResponseBody", "([BJJ)I");
726+
(*env)->GetMethodID(env, cls, "onResponseBody", "(Ljava/nio/ByteBuffer;JJ)I");
727727
AWS_FATAL_ASSERT(s3_meta_request_response_handler_native_adapter_properties.onResponseBody);
728728

729729
s3_meta_request_response_handler_native_adapter_properties.onFinished = (*env)->GetMethodID(

src/native/s3_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static int s_on_s3_meta_request_body_callback(
623623
return AWS_OP_ERR;
624624
}
625625

626-
jobject jni_payload = aws_jni_byte_array_from_cursor(env, body);
626+
jobject jni_payload = aws_jni_direct_byte_buffer_from_raw_ptr(env, body->ptr, body->len);
627627
if (jni_payload == NULL) {
628628
/* JVM is out of memory, but native code can still have memory available, handle it and don't crash. */
629629
aws_jni_check_and_clear_exception(env);

0 commit comments

Comments
 (0)