public class BlobManager
extends java.lang.Object
| Constructor and Description |
|---|
BlobManager(BlobStoreStrategy blobStoreStrategy,
android.app.DownloadManager downloadManager,
android.content.SharedPreferences sharedPreferences,
android.content.res.AssetManager assetManager,
BlobFactory blobFactory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allBlobsAvailable(java.util.Collection<Blob> blobs) |
java.util.HashSet<Blob> |
blobsToDownload(java.util.Collection<Language> languages) |
long |
fetch(Blob blob,
boolean allowMeteredNetwork)
Launches asynchronous fetch of a given
Blob if it is not already
available in local destination folder. |
java.util.Set<Language> |
getAllLanguagesWithAvailableOcrBlobs() |
boolean |
hasActiveDownloads() |
boolean |
isBlobAvailable(Blob blob) |
public BlobManager(BlobStoreStrategy blobStoreStrategy,
android.app.DownloadManager downloadManager,
android.content.SharedPreferences sharedPreferences,
android.content.res.AssetManager assetManager,
BlobFactory blobFactory)
public boolean allBlobsAvailable(java.util.Collection<Blob> blobs)
true if all blobs from collection are available locally. false if
at least one blob is not available. If collection is empty returns truepublic boolean isBlobAvailable(Blob blob)
true if Blob is available on local filesystem.
false otherwise.public java.util.Set<Language> getAllLanguagesWithAvailableOcrBlobs() throws java.io.IOException
java.io.IOExceptionisBlobAvailable(net.doo.snap.entity.Blob)public long fetch(Blob blob, boolean allowMeteredNetwork) throws java.io.IOException
Blob if it is not already
available in local destination folder. Might perform blocking operations, so it should not be
called from the main thread.-1 if blob is available locallyjava.io.IOExceptionDownloadManager.enqueue(DownloadManager.Request),
isBlobAvailable(net.doo.snap.entity.Blob)public boolean hasActiveDownloads()
true if some blobs are still in fetch process (or paused). false
if all requested downloads completed. This method performs blocking operation, so it should not be
called from the main thread.