@ThreadSafe public class ContentManagerAsync extends ContentManager
ContentManagerAsync
provides a simple API for uploading and downloading
documents to/from Amazon WorkDocs easily.
ContentManagerAsync
, like all the client classes in the AWS SDK for Java, is thread safe.
Call ContentManagerAsync.shutdownNow(true)
to release the resources once the
operation is complete. If you want to keep Amazon WorkDocs client open, then call ContentManagerAsync.shutdownNow(false)
.
In order to use ContentManager
:
AWSStaticCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()); AmazonWorkDocs client = AmazonWorkDocsClient.builder().withCredentials(credentialsProvider).withRegion(Regions.REGION).build(); ContentManagerAsync contentManager = ContentManagerAsyncBuilder.standard().withWorkDocsClient(client).withAuthenticationToken(authenticationToken).build(); GetDocumentStreamRequest request = new GetDocumentStreamRequest(); request.setDocumentId("doc-id"); InputStream inputStream = contentManager.getDocumentStreamAsync(request).get().getStream(); contentManager.shutdownNow(true);
Modifier and Type | Method and Description |
---|---|
Future<GetDocumentStreamResult> |
getDocumentStreamAsync(GetDocumentStreamRequest getDocumentStreamRequest)
Asynchronously gets document stream of latest version of given document and version ID.
|
void |
shutdownNow(boolean shutdownWorkDocsClient)
Forcefully shuts down this ContentManager instance - currently executing
operations will not be allowed to finish.
|
Future<UploadDocumentStreamResult> |
uploadDocumentStreamAsync(UploadDocumentStreamRequest uploadDocumentStreamRequest)
Asynchronously uploads stream to given folder and document name.
|
getDocumentStream, uploadDocumentStream
public Future<GetDocumentStreamResult> getDocumentStreamAsync(GetDocumentStreamRequest getDocumentStreamRequest)
getDocumentStreamRequest
- Request specifying parameters of the operation.public Future<UploadDocumentStreamResult> uploadDocumentStreamAsync(UploadDocumentStreamRequest uploadDocumentStreamRequest) throws IllegalArgumentException
uploadDocumentStreamRequest
- Request specifying parameters of the operation.IllegalArgumentException
public void shutdownNow(boolean shutdownWorkDocsClient)
Callers should also remember that uploaded parts from an interrupted upload may not always be automatically cleaned up.
shutdownWorkDocsClient
- Whether to shut down the underlying Amazon WorkDocs client.Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.