Skip to content

Use snippet for AsyncRequestBody.forBlockingInputStream documentation. #3610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -179,24 +179,26 @@ static AsyncRequestBody fromInputStream(InputStream inputStream, Long contentLen
*
* <p><b>Example Usage</b>
*
* <pre>
* S3Client s3 = ...;
* <p>
* {@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<PutObjectResponse> 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();
* </pre>
* }
*/
static BlockingInputStreamAsyncRequestBody forBlockingInputStream(Long contentLength) {
return new BlockingInputStreamAsyncRequestBody(contentLength);
Expand Down