diff --git a/core/sdk-core/src/main/java/software/amazon/awssdk/core/async/AsyncRequestBody.java b/core/sdk-core/src/main/java/software/amazon/awssdk/core/async/AsyncRequestBody.java index 69ce5fe5de8d..1c440bf0bde3 100644 --- a/core/sdk-core/src/main/java/software/amazon/awssdk/core/async/AsyncRequestBody.java +++ b/core/sdk-core/src/main/java/software/amazon/awssdk/core/async/AsyncRequestBody.java @@ -179,24 +179,26 @@ static AsyncRequestBody fromInputStream(InputStream inputStream, Long contentLen * *
Example Usage * - *
- * S3Client s3 = ...; + *+ * } */ static BlockingInputStreamAsyncRequestBody forBlockingInputStream(Long contentLength) { return new BlockingInputStreamAsyncRequestBody(contentLength);+ * {@snippet : + * S3AsyncClient s3 = S3AsyncClient.create(); // Use one client for your whole application! * - * InputStream streamToWrite = ...; - * long streamToWriteLength = ...; + * byte[] dataToSend = "Hello".getBytes(StandardCharsets.UTF_8); + * InputStream streamToSend = new ByteArrayInputStream(); + * long streamToSendLength = dataToSend.length(); * * // Start the operation * BlockingInputStreamAsyncRequestBody body = - * AsyncRequestBody.forBlockingInputStream(streamToWriteLength); + * AsyncRequestBody.forBlockingInputStream(streamToSendLength); * CompletableFuture
responseFuture = * s3.putObject(r -> r.bucket("bucketName").key("key"), body); * * // Write the input stream to the running operation - * body.writeInputStream(streamToWrite); + * body.writeInputStream(streamToSend); * * // Wait for the service to respond. * PutObjectResponse response = responseFuture.join(); - *