You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2023/04/12 06:09:27 UTC

[pdfbox-docs] branch master updated: PDFBOX-5030: new stream caching added

This is an automated email from the ASF dual-hosted git repository.

lehmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-docs.git


The following commit(s) were added to refs/heads/master by this push:
     new 2adb06e5 PDFBOX-5030: new stream caching added
2adb06e5 is described below

commit 2adb06e5597d3ca2bd291de31fb69a26685a75d8
Author: Andreas Lehmkühler <an...@lehmi.de>
AuthorDate: Wed Apr 12 08:08:47 2023 +0200

    PDFBOX-5030: new stream caching added
---
 content/3.0/migration.md | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/content/3.0/migration.md b/content/3.0/migration.md
index b2662e20..44d082f8 100644
--- a/content/3.0/migration.md
+++ b/content/3.0/migration.md
@@ -81,6 +81,8 @@ The whole code was overhauled including the following changes:
 - provide an interface to implement an individual class to read an pdf
 - provide an interface to implement an individual cache holding streams when creating/writing a pdf
 
+#### Reader implementations
+
 PDFBox offers the following implementations of the interface "org.apache.pdfbox.io.RandomAccessRead" to be used as source to read a pdf:
 
 - ***org.apache.pdfbox.io.RandomAccessReadBuffer***
@@ -99,7 +101,19 @@ RandomAccessReadMemoryMappedFile uses the memory mapping feature of java. The wh
 
 - ***Implementing your own reader***
 
-If there is any need to implement your own reader one has to implement the interface `org.apache.pdfbox.io.RandomAccessRead`. It shall be done thread safe to avoid issues in multithreaded environments.
+If there is any need to implement a different reader one has to implement the interface `org.apache.pdfbox.io.RandomAccessRead`. It shall be done thread safe to avoid issues in multithreaded environments.
+
+#### Stream cache
+
+PDFBox 3.0.x no longer uses a separate cache when reading a pdf, but still does for write operations. 
+
+***Default stream cache***
+
+3.0.x introduces the interface `RandomAccessStreamCache` to define a cache in a more flexible way. The well known class `ScratchFile` is the default implementation. The MemoryUsageSetting parameter within the loadPDF methods was replaced by a parameter using the new functional interface `StreamCacheCreateFunction` to encapsulate the caching details within the IO package. `IOUtils` provides two variants of a possible cache (memory only and temporary file only) for convenience. The loader  [...]
+
+***Implementing your own stream cache***
+
+If there is any need to implement a different cache one has to implement the interface `org.apache.pdfbox.io.RandomAccessStreamCache`. It shall be done thread safe to avoid issues in multithreaded environments.
 
 ### Use **Loader** to get a PDF document