Class ActionFileUpgradeUtil
- java.lang.Object
-
- com.google.android.exoplayer2.offline.ActionFileUpgradeUtil
-
public final class ActionFileUpgradeUtil extends Object
Utility class for upgrading legacy action files intoDefaultDownloadIndex.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceActionFileUpgradeUtil.DownloadIdProviderProvides download IDs during action file upgrade.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidupgradeAndDelete(File actionFilePath, ActionFileUpgradeUtil.DownloadIdProvider downloadIdProvider, DefaultDownloadIndex downloadIndex, boolean deleteOnFailure, boolean addNewDownloadsAsCompleted)MergesDownloadRequestscontained in a legacy action file into aDefaultDownloadIndex, deleting the action file if the merge is successful or ifdeleteOnFailureistrue.
-
-
-
Method Detail
-
upgradeAndDelete
@WorkerThread public static void upgradeAndDelete(File actionFilePath, @Nullable ActionFileUpgradeUtil.DownloadIdProvider downloadIdProvider, DefaultDownloadIndex downloadIndex, boolean deleteOnFailure, boolean addNewDownloadsAsCompleted) throws IOException
MergesDownloadRequestscontained in a legacy action file into aDefaultDownloadIndex, deleting the action file if the merge is successful or ifdeleteOnFailureistrue.This method must not be called while the
DefaultDownloadIndexis being used by aDownloadManager.This method may be slow and shouldn't normally be called on the main thread.
- Parameters:
actionFilePath- The action file path.downloadIdProvider- A download ID provider, ornull. Ifnullthen ID of each download will be its custom cache key if one is specified, or else its URL.downloadIndex- The index into which the requests will be merged.deleteOnFailure- Whether to delete the action file if the merge fails.addNewDownloadsAsCompleted- Whether to add new downloads as completed.- Throws:
IOException- If an error occurs loading or merging the requests.
-
-