TransferUtility
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 |
|---|---|
| TransferNetworkLossHandler |
A Broadcast receiver to receive network connection change events.
|
| TransferObserver |
TransferObserver is used to track state and progress of a transfer.
|
| TransferService |
TransferService is limited to the following functionality:
Registers a listener with Android OS for network connectivity
changes.
|
| TransferUtility |
The transfer utility is a high-level class for applications to upload and
download files.
|
| TransferUtility.Builder |
Builder class for TransferUtility
|
| TransferUtilityOptions |
Configuration information used by the
TransferUtility
and TransferService |
| UploadOptions |
Options used to configure the upload of an object using
TransferUtility. |
| UploadOptions.Builder |
Builder class for UploadOptions
|
| Enum | Description |
|---|---|
| TransferNetworkConnectionType |
Represents the type of connection a transfer is allowed to use
|
| TransferState |
The current state of a transfer.
|
| TransferType |
Represents if a transfer is an upload or download
|
| Exception | Description |
|---|---|
| TransferUtilityException |
Checked Exception thrown by TransferUtility
|
TransferUtility
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 transferUtility = new TransferUtility(s3, getApplicationContext());
// Starts a download
TransferObserver observer = transferUtility.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. transferUtility.pause(id); // Resumes the transfer. transferUtility.resume(id);For cancelling and deleting tasks:
// Cancels the transfer. transferUtility.cancel(id); // Deletes the transfer. transferUtility.delete(id);
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.