Interface KiiRTransfer
-
- All Known Implementing Classes:
KiiDownloader
,KiiUploader
public interface KiiRTransfer
Interface provides resumable transfer operation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FileHolder
getFileHolder()
Get the File Holder instance which this transfer bounded.KiiRTransferInfo
info()
Get the information of this transfer includes status and progress information.void
infoAsync(KiiRTransferCallback callback)
Asynchronous call ofinfo()
NOTE: This method should be executed in UI thread.void
suspend()
Suspend this transfer.void
suspendAsync(KiiRTransferCallback callback)
Asynchronous call ofsuspend()
NOTE: This method should be executed in UI thread.void
terminate()
Terminate this transfer.void
terminateAsync(KiiRTransferCallback callback)
Asynchronous call ofterminate()
NOTE: This method should be executed in UI thread.void
transfer(KiiRTransferProgressCallback progress)
Start the transfer of the body.void
transferAsync(KiiRTransferCallback callback)
Asynchronous call oftransfer(KiiRTransferProgressCallback)
.
-
-
-
Method Detail
-
getFileHolder
FileHolder getFileHolder()
Get the File Holder instance which this transfer bounded.- Returns:
- instance of FileHolder
-
transfer
void transfer(KiiRTransferProgressCallback progress) throws AlreadyStartedException, SuspendedException, TerminatedException, StateStoreAccessException
Start the transfer of the body. Blocking until the completion of transfer. If the transfer is in resumable state, Automatically try to resume. Otherwise start transfer from the beginning.
NOTE: This api access to server. Should not be executed in UI/Main thread.- Parameters:
progress
- Notifies progress. Can be null if the progress update is not necessary.- Throws:
AlreadyStartedException
- thrown when the transfer has already started.SuspendedException
- thrown when the transfer has suspended by error or callingsuspend()
/suspendAsync(KiiRTransferCallback)
TerminatedException
- thrown when the transfer has terminated by error or callingterminate()
/terminateAsync(KiiRTransferCallback)
StateStoreAccessException
- thrown when failed to access the persistent storage that stores status of transfer. (ex. Disk full, etc.) The transfer will be suspended and you can safely retry.
-
transferAsync
void transferAsync(KiiRTransferCallback callback)
Asynchronous call oftransfer(KiiRTransferProgressCallback)
.
NOTE: This method should be executed in UI thread.- Parameters:
callback
- notifies events.
-
suspend
void suspend() throws NoEntryException, StateStoreAccessException
Suspend this transfer. If already suspended, do nothing.
NOTE: This api access to persistent storage stores status of transfer . Should not be executed in UI/Main thread.- Throws:
NoEntryException
- There are no transfer in running/suspended state. Transfer has not started yet or already done.StateStoreAccessException
- thrown when failed to access persistent storage stores transfer status. (ex. Disk full, etc.) Suspend will be failed.
-
suspendAsync
void suspendAsync(KiiRTransferCallback callback)
Asynchronous call ofsuspend()
NOTE: This method should be executed in UI thread.- Parameters:
callback
- notifies events.
-
terminate
void terminate() throws NoEntryException, StateStoreAccessException
Terminate this transfer. It will cancel transfer and discard the state of Transfer stored in persistent storage. The transfer will be started from beginning when you calltransfer(KiiRTransferProgressCallback)
/transferAsync(KiiRTransferCallback)
after the termination.- Throws:
NoEntryException
- There are no transfer in running/suspended state. Transfer has not started yet or already done.StateStoreAccessException
- thrown when failed to access persistent storage stores transfer status. (ex. Disk full, etc.) Ongoing upload will be cancelled but failed to remove the stored state. The state will be transit to suspended.
-
terminateAsync
void terminateAsync(KiiRTransferCallback callback)
Asynchronous call ofterminate()
NOTE: This method should be executed in UI thread.- Parameters:
callback
- notifies events.
-
info
KiiRTransferInfo info() throws StateStoreAccessException
Get the information of this transfer includes status and progress information.
NOTE: This api access to internal file storage stores status of upload . Should not be executed in UI/Main thread.- Returns:
- KiiRTransferInfo represents status of transfer
- Throws:
StateStoreAccessException
- thrown when failed to access persistent storage stores transfer status. (ex. Disk full, etc.)- See Also:
KiiRTransferInfo
-
infoAsync
void infoAsync(KiiRTransferCallback callback)
Asynchronous call ofinfo()
NOTE: This method should be executed in UI thread.- Parameters:
callback
- notifies events.
-
-