Package com.castlabs.android.downloader
Class DownloadableResource
- java.lang.Object
-
- com.castlabs.android.downloader.DownloadableResource
-
public class DownloadableResource extends Object
Model that is used to add resources to a download session when implementingDownloadable.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
Fields Modifier and Type Field Description longlengthThe length in bytes orSdkConsts.LENGTH_UNBOUNDEDif unknownStringtargetThe absolute path to the local target path.inttypeThe chunk type, for exampleSdkConsts.THUMBNAIL.UriuriThe sources URL
-
Constructor Summary
Constructors Constructor Description DownloadableResource()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilecreateTarget(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 Detail
-
uri
public Uri uri
The sources URL
-
target
public String target
The absolute path to the local target path. SeecreateTarget(Uri, File, String, boolean)to generate teh local path.
-
type
public int type
The chunk type, for exampleSdkConsts.THUMBNAIL.
-
length
public long length
The length in bytes orSdkConsts.LENGTH_UNBOUNDEDif unknown
-
-
Method Detail
-
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
-
-