public class DownloadImpl extends AbstractTransfer implements Download
Transfer.TransferState
Modifier and Type | Field and Description |
---|---|
private java.io.File |
file |
private GetObjectRequest |
getObjectRequest |
private java.lang.Integer |
lastFullyDownloadedPartNumber
The last part that has been successfully written into the downloaded file.
|
private ObjectMetadata |
objectMetadata |
private PersistableDownload |
persistableDownload
Information to resume if the download is paused.
|
private ProgressListenerChain |
progressListenerChain |
private S3Object |
s3Object |
listenerChain, monitor, state, stateChangeListeners
Constructor and Description |
---|
DownloadImpl(java.lang.String description,
TransferProgress transferProgress,
ProgressListenerChain progressListenerChain,
S3Object s3Object,
TransferStateChangeListener listener,
GetObjectRequest getObjectRequest,
java.io.File file)
Deprecated.
|
DownloadImpl(java.lang.String description,
TransferProgress transferProgress,
ProgressListenerChain progressListenerChain,
S3Object s3Object,
TransferStateChangeListener listener,
GetObjectRequest getObjectRequest,
java.io.File file,
ObjectMetadata objectMetadata,
boolean isDownloadParallel) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Cancels this download.
|
void |
abortWithoutNotifyingStateChangeListener()
Cancels this download, but skip notifying the state change listeners.
|
private PersistableDownload |
captureDownloadState(GetObjectRequest getObjectRequest,
java.io.File file)
Returns the captured state of the download; or null if it should not be
captured (for security reason).
|
java.lang.String |
getBucketName()
The name of the bucket where the object is being downloaded from.
|
java.lang.String |
getKey()
The key under which this object was stored in Amazon S3.
|
java.lang.Integer |
getLastFullyDownloadedPartNumber()
For parallel downloads, returns the last part number that was
successfully written into the download file.
|
ObjectMetadata |
getObjectMetadata()
Returns the ObjectMetadata for the object being downloaded.
|
PersistableDownload |
pause()
Pause the current download operation and returns the information that can
be used to resume the download at a later time.
|
void |
setS3Object(S3Object s3Object)
Set the S3 object to download.
|
void |
setState(Transfer.TransferState state)
This method is also responsible for firing COMPLETED signal to the
listeners.
|
void |
updatePersistableTransfer(java.lang.Integer lastFullyDownloadedPartNumber)
Only for internal use.
|
addProgressListener, addProgressListener, addStateChangeListener, fireProgressEvent, getDescription, getMonitor, getProgress, getState, isDone, notifyStateChangeListeners, removeProgressListener, removeProgressListener, removeStateChangeListener, rethrowExecutionException, setMonitor, unwrapExecutionException, waitForCompletion, waitForException
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addProgressListener, addProgressListener, getDescription, getProgress, getState, isDone, removeProgressListener, removeProgressListener, waitForCompletion, waitForException
private S3Object s3Object
private PersistableDownload persistableDownload
private java.lang.Integer lastFullyDownloadedPartNumber
private final GetObjectRequest getObjectRequest
private final java.io.File file
private final ObjectMetadata objectMetadata
private final ProgressListenerChain progressListenerChain
@Deprecated public DownloadImpl(java.lang.String description, TransferProgress transferProgress, ProgressListenerChain progressListenerChain, S3Object s3Object, TransferStateChangeListener listener, GetObjectRequest getObjectRequest, java.io.File file)
public DownloadImpl(java.lang.String description, TransferProgress transferProgress, ProgressListenerChain progressListenerChain, S3Object s3Object, TransferStateChangeListener listener, GetObjectRequest getObjectRequest, java.io.File file, ObjectMetadata objectMetadata, boolean isDownloadParallel)
public ObjectMetadata getObjectMetadata()
getObjectMetadata
in interface Download
public java.lang.String getBucketName()
getBucketName
in interface Download
public java.lang.String getKey()
public void updatePersistableTransfer(java.lang.Integer lastFullyDownloadedPartNumber)
public java.lang.Integer getLastFullyDownloadedPartNumber()
public void abort() throws java.io.IOException
public void abortWithoutNotifyingStateChangeListener() throws java.io.IOException
java.io.IOException
public void setS3Object(S3Object s3Object)
public void setState(Transfer.TransferState state)
setState
in class AbstractTransfer
private PersistableDownload captureDownloadState(GetObjectRequest getObjectRequest, java.io.File file)
public PersistableDownload pause() throws PauseException
Download
CryptoMode.StrictAuthenticatedEncryption
would result in
AmazonClientException as authenticity cannot be guaranteed for a range
get operation.pause
in interface Download
PauseException
- If any errors were encountered while trying to pause the
download.