Interface Upload
- All Superinterfaces:
Transfer
Represents an asynchronous upload to Amazon S3.
See TransferManager
for more information about creating transfers.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.amazonaws.services.s3.transfer.Transfer
Transfer.TransferState
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Abort the current upload operation.pause()
Pause the current upload operation and returns the information that can be used to resume the upload.tryPause
(boolean forceCancelTransfers) Tries to pause the current upload operation and returns the information that can be used to resume the upload.Waits for this upload to complete and returns the result of this upload.Methods inherited from interface com.amazonaws.services.s3.transfer.Transfer
addProgressListener, addProgressListener, getDescription, getProgress, getState, isDone, removeProgressListener, removeProgressListener, waitForCompletion, waitForException
-
Method Details
-
waitForUploadResult
UploadResult waitForUploadResult() throws AmazonClientException, AmazonServiceException, InterruptedExceptionWaits for this upload to complete and returns the result of this upload. This is a blocking call. Be prepared to handle errors when calling this method. Any errors that occurred during the asynchronous transfer will be re-thrown through this method.- Returns:
- The result of this transfer.
- Throws:
AmazonClientException
- If any errors were encountered in the client while making the request or handling the response.AmazonServiceException
- If any errors occurred in Amazon S3 while processing the request.InterruptedException
- If this thread is interrupted while waiting for the upload to complete.
-
pause
Pause the current upload operation and returns the information that can be used to resume the upload. Upload cannot be paused in the following cases.- The data source is an input stream.
- Client side encryption is used.
- Server Side Encryption with customer provided key is used.
- Size of the file being uploaded is less than the
TransferManagerConfiguration.getMultipartUploadThreshold()
.
PauseFailure
exception is thrown- Returns:
- An opaque token that holds some private state and can be used to resume a paused download operation.
- Throws:
PauseException
- If failed to pause the operation.
-
tryPause
Tries to pause the current upload operation and returns the information that can be used to resume the upload. Upload cannot be paused in the following cases.- The data source is an input stream.
- Client side encryption is used.
- Server Side Encryption with customer provided key is used.
- Size of the file being uploaded is less than the
TransferManagerConfiguration.getMultipartUploadThreshold()
.
- Parameters:
forceCancelTransfers
- a boolean to forcefully abort the existing uploads if pause cannot be done.- Returns:
- a result of pause operation.
-
abort
void abort()Abort the current upload operation.
-