pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1825293 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/JPXFilter.java
Date Sun, 25 Feb 2018 08:37:23 GMT
Author: tilman
Date: Sun Feb 25 08:37:23 2018
New Revision: 1825293

URL: http://svn.apache.org/viewvc?rev=1825293&view=rev
Log:
PDFBOX-4121: use much faster MemoryCacheImageInputStream instead of result of ImageIO.createImageInputStream
which is a FileCacheImageInputStream

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/JPXFilter.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/JPXFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/JPXFilter.java?rev=1825293&r1=1825292&r2=1825293&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/JPXFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/JPXFilter.java Sun Feb 25 08:37:23
2018
@@ -24,9 +24,9 @@ import java.awt.image.WritableRaster;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import javax.imageio.ImageIO;
 import javax.imageio.ImageReader;
 import javax.imageio.stream.ImageInputStream;
+import javax.imageio.stream.MemoryCacheImageInputStream;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.graphics.color.PDJPXColorSpace;
@@ -82,7 +82,8 @@ public final class JPXFilter extends Fil
     private BufferedImage readJPX(InputStream input, DecodeResult result) throws IOException
     {
         ImageReader reader = findImageReader("JPEG2000", "Java Advanced Imaging (JAI) Image
I/O Tools are not installed");
-        try (ImageInputStream iis = ImageIO.createImageInputStream(input))
+        // PDFBOX-4121: ImageIO.createImageInputStream() is much slower
+        try (ImageInputStream iis = new MemoryCacheImageInputStream(input))
         {
             reader.setInput(iis, true, true);
 



Mime
View raw message