Package com.castlabs.android.downloader
Class DownloadableResource
java.lang.Object
com.castlabs.android.downloader.DownloadableResource
Model that is used to add resources to a download session when implementing
Downloadable
.
Please note that you usually do not interact with the class. It is used by other plugins to expose a downloader resource and it is port of the core SDK to avoid an explicit dependency to the Downloader Plugin.
- Since:
- 4.0.0
-
Field Summary
Modifier and TypeFieldDescriptionlong
The length in bytes orSdkConsts.LENGTH_UNBOUNDED
if unknownThe absolute path to the local target path.int
The chunk type, for exampleSdkConsts.THUMBNAIL
.The sources URL -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic File
createTarget
(Uri resource, File basePath, String remoteManifestUrl, boolean relativeToManifest) Create a path to a local file given the remote resource, the manifest URL and the base path.
-
Field Details
-
uri
The sources URL -
target
The absolute path to the local target path. SeecreateTarget(Uri, File, String, boolean)
to generate teh local path. -
type
public int typeThe chunk type, for exampleSdkConsts.THUMBNAIL
. -
length
public long lengthThe length in bytes orSdkConsts.LENGTH_UNBOUNDED
if unknown
-
-
Constructor Details
-
DownloadableResource
public DownloadableResource()
-
-
Method Details
-
createTarget
public static File createTarget(@NonNull Uri resource, @NonNull File basePath, @Nullable String remoteManifestUrl, boolean relativeToManifest) Create a path to a local file given the remote resource, the manifest URL and the base path. If specified, this will create a target folder relative to the manifest if that is possible, i.e. the manifest comes from the same host and has the same base path structure.- Parameters:
resource
- The URL to the resource to downloadbasePath
- The target folder base pathremoteManifestUrl
- The URL to the manifestrelativeToManifest
- If true, this will try to resolve a path relative to the manifest- Returns:
- The local target path for this resource
-