diff options
author | Matt Holgate <matt@emobix.co.uk> | 2014-07-03 11:11:35 +0100 |
---|---|---|
committer | Matt Holgate <matt@emobix.co.uk> | 2014-07-03 11:11:35 +0100 |
commit | 3b2bc7c15844af39ac08fe5b0a9681ba1cce2dc0 (patch) | |
tree | 452d0e9d2167618fa301adda1ab20650e6a456d9 /platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | |
parent | 4f9f55bf8176ffbe75c958a93e1cc47c70f50e89 (diff) | |
download | mupdf-3b2bc7c15844af39ac08fe5b0a9681ba1cce2dc0.tar.xz |
Android: Prevent editing of files opened from a memory buffer.
Memory buffers are used for implementing content:// URLs, which are
(in most cases) readonly. If we ever encounter a read/write content://
URL in the future, we could consider supporting saving to it.
(An example of a content:// URI is an email attachment, where IPC is used
to transfer the file from the email client, rather than relying on a local
file).
Diffstat (limited to 'platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java index 0532b61d..750540b7 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFCore.java @@ -22,6 +22,7 @@ public class MuPDFCore private byte fileBuffer[]; private String file_format; private boolean isUnencryptedPDF; + private final boolean wasOpenedFromBuffer; /* The native functions */ private native long openFile(String filename); @@ -112,6 +113,7 @@ public class MuPDFCore } file_format = fileFormatInternal(); isUnencryptedPDF = isUnencryptedPDFInternal(); + wasOpenedFromBuffer = false; } public MuPDFCore(Context context, byte buffer[], String magic) throws Exception { @@ -123,6 +125,7 @@ public class MuPDFCore } file_format = fileFormatInternal(); isUnencryptedPDF = isUnencryptedPDFInternal(); + wasOpenedFromBuffer = true; } public int countPages() @@ -143,6 +146,11 @@ public class MuPDFCore return isUnencryptedPDF; } + public boolean wasOpenedFromBuffer() + { + return wasOpenedFromBuffer; + } + private synchronized int countPagesSynchronized() { return countPagesInternal(); } |