| java.lang.Object | ||
| ↳ | com.pspdfkit.document.providers.ContextDataProvider | |
| ↳ | com.pspdfkit.document.providers.InputStreamDataProvider | |
Known Direct Subclasses
|
Abstract data provider that handles serving a PDF document from an InputStream. Since viewing the PDF
document needs random access, this class wraps the logic for re-opening the stream for backwards-seek operations.
Subclasses need to override the openInputStream() method, which needs to return a new
InputStream instance every time it is called.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pspdfkit.document.providers.DataProvider
| |||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pspdfkit.document.providers.DataProvider
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| InputStreamDataProvider() | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| byte[] | read(long size, long offset) | ||||||||||
| void | release() | ||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| long |
getInputStreamPosition()
Returns the current position inside the read
InputStream. | ||||||||||
| abstract InputStream |
openInputStream()
Subclasses need to override this method and return a readable input stream which servers the PDF document.
| ||||||||||
| final void |
reopenInputStream()
Close the internal input stream and reopen it.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.pspdfkit.document.providers.ContextDataProvider
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.pspdfkit.document.providers.DataProvider
| |||||||||||
Returns the current position inside the read InputStream. Every read operation on the data provider
will increase this position. To reset the read position to 0 call reopenInputStream().
Subclasses need to override this method and return a readable input stream which servers the PDF document. This
method must return a new InputStream instance every time it is called. This is
necessary so InputStreamDataProvider can actually "simulate" random data access on the underlying stream.
| Exception | If the implementation fails to open the input stream for reading. |
|---|
Close the internal input stream and reopen it. This is used to rewind the stream, if it is necessary to "seek backwards". Subclasses may call this method to safely rewind the stream to the beginning.
| Exception | If the implementation fails to close or open the input stream for reading. |
|---|