| com.pspdfkit.document.providers.WritableDataProvider |
Known Indirect Subclasses
|
WritableDataProvider is an interface which should be implemented by any DataProvider that should support
saving PDF documents. Classes implementing this interface must implement all methods from this interface and from
DataProvider interface for document loading and saving to work properly.
Classes implementing this interface need to implement all methods correctly to allow PSPDFKit loading documents.
Furthermore, if classes with this interface are meant to be used with PdfActivity, they must also implement
Parcelable. If you plan to use the DataProvider only for PdfFragment parcelation
code is not necessary.
All callbacks will be called on a background thread.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| enum | WritableDataProvider.WriteMode | Describes possible write modes for the output. | |||||||||
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pspdfkit.document.providers.DataProvider
| |||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pspdfkit.document.providers.DataProvider
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| abstract boolean |
canWrite()
Indicates whether this data provider is writable.
| ||||||||||
| abstract boolean |
finishWrite()
Called by PSPDFKit after all data has been written via
write(byte[]) method. | ||||||||||
| abstract boolean |
startWrite(WritableDataProvider.WriteMode writeMode)
Called before writing to the file begins so the provider can prepare file output.
| ||||||||||
| abstract boolean |
supportsAppending()
Reports whether this provider supports appending to output file as opposed to always rewriting it.
| ||||||||||
| abstract boolean |
write(byte[] data)
Called by PSPDFKit to write data to the document.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pspdfkit.document.providers.DataProvider
| |||||||||||
Indicates whether this data provider is writable.
true if the data provider can be written to, false if not.
Called by PSPDFKit after all data has been written via write(byte[]) method. This
allows the data provider to close all opened input streams. In case of REWRITE_FILE access, the
data provider should here replace the original file with the written temporary file.
true if operation succeeded, false if it failed.
Called before writing to the file begins so the provider can prepare file output.
| writeMode | Determines how file data should be written to the output. For APPEND_TO_FILE
the data should be added to the end of existing file data. For REWRITE_FILE
PSPDFKit will write full PDF document and the data should be written to a temporary file. The
temporary file should replace then original file in finishWrite() callback method.
Original file must not be written to when rewriting is in progress - PSPDFKit will issue
read(long, long) calls while writing and attempting to write output to the same input
will result in a corrupted file. |
|---|
true if operation succeeded, false if writing should be aborted.
Reports whether this provider supports appending to output file as opposed to always rewriting it. If this
returns false, only REWRITE_FILE will be used and the PDF file will always be fully rewritten
on save.
Note that if true is returned here, both WritableDataProvider.WriteMode options must be supported by this
DataProvider since some documents cannot be saved incrementally.
true if this provider supports APPEND_TO_FILE save mode.
Called by PSPDFKit to write data to the document. This callback will be called multiple times in a writing operation.
| data | Data to be written to the file. |
|---|
true if writing succeeded, false if the write operation should be aborted.