s3.transferservice.transferManager
which is a high level client that provides methods to control users' upload and download tasks.See: Description
| Interface | Description |
|---|---|
| TransferListener |
Listener interface for transfer state and progress changes.
|
| Class | Description |
|---|---|
| TransferObserver |
TransferObserver is used to track state and progress of a transfer.
|
| TransferService |
Performs background upload and download tasks.
|
| TransferUtility |
The transfer manager is a high-level class for applications to upload and
download files.
|
| Enum | Description |
|---|---|
| TransferState |
The current state of a transfer.
|
| TransferType |
Represents if a transfer is an upload or download
|
s3.transferservice.transferManager
which is a high level client that provides methods to control users' upload and download tasks.
For starting transfer tasks, here is a sample usage.
// Initializes TransferUtility
TransferUtility transferManager = new TransferUtility(s3, getApplicationContext());
// Starts a download
TransferObserver observer = transferManager.download("bucket_name", "key", file);
observer.setTransferListener(new TransferListener() {
public void onStateChanged(int id, String newState) {
// Do something in the callback.
}
public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
// Do something in the callback.
}
public void onError(int id, Exception e) {
// Do something in the callback.
}
});
For pausing and resuming tasks:
// Gets id of the transfer. int id = observer.getId(); // Pauses the transfer. transferManager.pause(id); // Resumes the transfer. transferManager.resume(id);For cancelling and deleting tasks:
// Cancels the transfer. transferManager.cancel(id); // Deletes the transfer. transferManager.delete(id);Please refer to
TransferUtility for more details.Copyright © 2016. All rights reserved.