com.pspdfkit.api.providers.WritableDataProvider |
![]() |
WritableDataProvider is an interface which should be implemented by any DataProvider
that should support
saving of data. 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 to read and write.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | WritableDataProvider.WriteMode | Describes possible write modes for the output. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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 source begins so the provider can prepare data 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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
access, the data
provider should here replace the original data with the written temporary data.
true
if operation succeeded, false
if it failed.
Called before writing to the source begins so the provider can prepare data output.
writeMode | Determines how the data should be written to the output. For APPEND the data should be added to the end of existing file
data. For REWRITE PSPDFKit will write full data load and
the data should be written to a temporary location. The temporary location should replace then
original data in finishWrite() callback method. Original data 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
will be used and the data 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 data cannot be appended.
true
if this provider supports APPEND
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.