-
public abstract class ZipDecompressionCallback<T extends Object> extends FileConflictCallback<DocumentFile>
Created on 02/01/22
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classZipDecompressionCallback.ReportCan't calculate write speed, progress and decompressed file size for the given period onStart, because we can't get the final size of the decompressed files unless we unzip it first, so only
bytesDecompressedandfileCountthat can be provided.public final classZipDecompressionCallback.DecompressionInfopublic enumZipDecompressionCallback.ErrorCode
-
Field Summary
Fields Modifier and Type Field Description private CoroutineScopeuiScope
-
Constructor Summary
Constructors Constructor Description ZipDecompressionCallback(CoroutineScope uiScope)ZipDecompressionCallback()
-
Method Summary
Modifier and Type Method Description final CoroutineScopegetUiScope()final UnitsetUiScope(CoroutineScope uiScope)UnitonValidate()LongonStart(T zipFile, Thread workerThread)BooleanonCheckFreeSpace(Long freeSpace, Long zipFileSize)Given freeSpaceandfileSize, then you decide whether the process will be continued or not.UnitonReport(ZipDecompressionCallback.Report report)UnitonCompleted(T zipFile, DocumentFile targetFolder, ZipDecompressionCallback.DecompressionInfo decompressionInfo)UnitonFailed(ZipDecompressionCallback.ErrorCode errorCode)-
-
Method Detail
-
getUiScope
final CoroutineScope getUiScope()
-
setUiScope
final Unit setUiScope(CoroutineScope uiScope)
-
onValidate
@UiThread() Unit onValidate()
-
onStart
@UiThread() Long onStart(T zipFile, Thread workerThread)
- Parameters:
zipFile- files to be decompressed.workerThread- Use Thread.interrupt to cancel the operation
-
onCheckFreeSpace
@WorkerThread() Boolean onCheckFreeSpace(Long freeSpace, Long zipFileSize)
Given
freeSpaceandfileSize, then you decide whether the process will be continued or not. You can give space tolerant here, e.g. 100MB. This function will not be triggered when decompressing MediaFile.- Parameters:
freeSpace- of target path
-
onReport
@UiThread() Unit onReport(ZipDecompressionCallback.Report report)
-
onCompleted
@UiThread() Unit onCompleted(T zipFile, DocumentFile targetFolder, ZipDecompressionCallback.DecompressionInfo decompressionInfo)
- Parameters:
zipFile- can be DocumentFile or MediaFile But for decompressing MediaFile, it is always0because we can't get the actual zip file size from SAF database.
-
onFailed
@UiThread() Unit onFailed(ZipDecompressionCallback.ErrorCode errorCode)
-
-
-
-