Class AssetDownloadSource
-
- All Implemented Interfaces:
-
com.pspdfkit.document.download.source.DownloadSource
public class AssetDownloadSource implements DownloadSource
A source for copying a PDF document from the app assets to the filesystem.
-
-
Constructor Summary
Constructors Constructor Description AssetDownloadSource(Context context, String assetPath)
Constructor taking an assetPath
pointing to a PDF document inside the app's assets.
-
Method Summary
Modifier and Type Method Description String
getAssetPath()
Returns the asset path of the served document. InputStream
open()
Opens an InputStream for downloading the document. long
getLength()
Returns the total length of the download. String
toString()
-
-
Constructor Detail
-
AssetDownloadSource
AssetDownloadSource(Context context, String assetPath)
Constructor taking anassetPath
pointing to a PDF document inside the app's assets.- Parameters:
context
- Context for accessing the document using a content resolver.assetPath
- The path pointing to a document in the app's assets.
-
-
Method Detail
-
getAssetPath
@NonNull() String getAssetPath()
Returns the asset path of the served document.
- Returns:
The relative path of the PDF document in the assets.
-
open
InputStream open()
Opens an InputStream for downloading the document.
- Returns:
A fresh input stream for downloading the PDF document.
-
getLength
long getLength()
Returns the total length of the download. This is optional and only used for calculating the Progress during download.
- Returns:
Total length of the download in bytes, or UNKNOWN_DOWNLOAD_SIZE.
-
-
-
-