public class

AssetDownloadSource

extends Object
implements DownloadSource
java.lang.Object
   ↳ com.pspdfkit.document.download.source.AssetDownloadSource

Class Overview

A source for copying a PDF document from the app assets to the filesystem.

Summary

[Expand]
Inherited Constants
From interface com.pspdfkit.document.download.source.DownloadSource
Public Constructors
AssetDownloadSource(Context context, String assetPath)
Constructor taking an assetPath pointing to a PDF document inside the app's assets.
Public Methods
String getAssetPath()
Returns the asset path of the served document.
long getLength()
Returns the total length of the download.
InputStream open()
Opens an InputStream for downloading the document.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pspdfkit.document.download.source.DownloadSource

Public Constructors

public AssetDownloadSource (Context context, String assetPath)

Constructor taking an assetPath 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.

Public Methods

public String getAssetPath ()

Returns the asset path of the served document.

Returns
  • The relative path of the PDF document in the assets.

public long getLength ()

Returns the total length of the download. This is optional and only used for calculating the Progress during download.

Returns

public InputStream open ()

Opens an InputStream for downloading the document.

Returns
  • A fresh input stream for downloading the PDF document.
Throws
IOException

public String toString ()