pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1832873 - in /pdfbox/trunk: examples/src/main/java/org/apache/pdfbox/examples/util/ pdfbox/src/main/java/org/apache/pdfbox/contentstream/ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font...
Date Mon, 04 Jun 2018 18:03:52 GMT
Author: lehmi
Date: Mon Jun  4 18:03:52 2018
New Revision: 1832873

URL: http://svn.apache.org/viewvc?rev=1832873&view=rev
Log:
PDFBOX-4237: use InputStream instead of PDContentStream

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/AppearanceGenerationTest.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDSquareAnnotationTest.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/ControlCharacterTest.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
Mon Jun  4 18:03:52 2018
@@ -124,7 +124,7 @@ public final class RemoveAllText
 
     private static List<Object> createTokensWithoutText(PDContentStream contentStream)
throws IOException
     {
-        PDFStreamParser parser = new PDFStreamParser(contentStream);
+        PDFStreamParser parser = new PDFStreamParser(contentStream.getContents());
         Object token = parser.parseNextToken();
         List<Object> newTokens = new ArrayList<>();
         while (token != null)

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
Mon Jun  4 18:03:52 2018
@@ -485,7 +485,7 @@ public abstract class PDFStreamEngine
     private void processStreamOperators(PDContentStream contentStream) throws IOException
     {
         List<COSBase> arguments = new ArrayList<>();
-        PDFStreamParser parser = new PDFStreamParser(contentStream);
+        PDFStreamParser parser = new PDFStreamParser(contentStream.getContents());
         Object token = parser.parseNextToken();
         while (token != null)
         {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java Mon
Jun  4 18:03:52 2018
@@ -19,11 +19,11 @@ package org.apache.pdfbox.pdfparser;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.pdfbox.contentstream.PDContentStream;
 import org.apache.pdfbox.contentstream.operator.Operator;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSBoolean;
@@ -56,9 +56,9 @@ public class PDFStreamParser extends Bas
      * @param contentStream The content stream to parse.
      * @throws IOException If there is an error initializing the stream.
      */
-    public PDFStreamParser(PDContentStream contentStream) throws IOException
+    public PDFStreamParser(InputStream stream) throws IOException
     {
-        super(new InputStreamSource(contentStream.getContents()));
+        super(new InputStreamSource(stream));
     }
     
     /**

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java
Mon Jun  4 18:03:52 2018
@@ -94,7 +94,7 @@ public final class PDType3CharProc imple
     public PDRectangle getGlyphBBox() throws IOException
     {
         List<COSBase> arguments = new ArrayList<>();
-        PDFStreamParser parser = new PDFStreamParser(this);
+        PDFStreamParser parser = new PDFStreamParser(getContents());
         Object token = parser.parseNextToken();
         while (token != null)
         {
@@ -149,7 +149,7 @@ public final class PDType3CharProc imple
     public float getWidth() throws IOException
     {
         List<COSBase> arguments = new ArrayList<>();
-        PDFStreamParser parser = new PDFStreamParser(this);
+        PDFStreamParser parser = new PDFStreamParser(getContents());
         Object token = parser.parseNextToken();
         while (token != null)
         {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
Mon Jun  4 18:03:52 2018
@@ -327,7 +327,7 @@ class AppearanceGeneratorHelper
      */
     private List<Object> tokenize(PDAppearanceStream appearanceStream) throws IOException
     {
-        PDFStreamParser parser = new PDFStreamParser(appearanceStream);
+        PDFStreamParser parser = new PDFStreamParser(appearanceStream.getContents());
         parser.parse();
         return parser.getTokens();
     }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
Mon Jun  4 18:03:52 2018
@@ -44,7 +44,7 @@ public class TestPDPageContentStream ext
             }
 
                 // now read the PDF stream and verify that the CMYK values are correct
-            PDFStreamParser parser = new PDFStreamParser(page);
+            PDFStreamParser parser = new PDFStreamParser(page.getContents());
             parser.parse();
             java.util.List<Object>  pageTokens = parser.getTokens();
             // expected five tokens :
@@ -71,7 +71,7 @@ public class TestPDPageContentStream ext
             }
 
             // now read the PDF stream and verify that the CMYK values are correct
-            parser = new PDFStreamParser(page);
+            parser = new PDFStreamParser(page.getContents());
             parser.parse();
             pageTokens = parser.getTokens();
             // expected five tokens  :
@@ -96,7 +96,7 @@ public class TestPDPageContentStream ext
     public void testMissingContentStream() throws IOException
     {
         PDPage page = new PDPage();
-        PDFStreamParser parser = new PDFStreamParser(page);
+        PDFStreamParser parser = new PDFStreamParser(page.getContents());
         parser.parse();
         List<Object> tokens = parser.getTokens();
         assertEquals(0, tokens.size());

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/AppearanceGenerationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/AppearanceGenerationTest.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/AppearanceGenerationTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/AppearanceGenerationTest.java
Mon Jun  4 18:03:52 2018
@@ -87,7 +87,7 @@ public class AppearanceGenerationTest
         
         // get the tokens of the content stream generated by Adobe
         PDAppearanceStream appearanceContentStream = annotation.getNormalAppearanceStream();
-        PDFStreamParser streamParser = new PDFStreamParser(appearanceContentStream);
+        PDFStreamParser streamParser = new PDFStreamParser(appearanceContentStream.getContents());
         
         streamParser.parse();
         List<Object> tokensForOriginal = streamParser.getTokens();
@@ -97,7 +97,7 @@ public class AppearanceGenerationTest
         annotation.constructAppearances();
         
         appearanceContentStream = annotation.getNormalAppearanceStream();
-        streamParser = new PDFStreamParser(appearanceContentStream);
+        streamParser = new PDFStreamParser(appearanceContentStream.getContents());
         
         streamParser.parse();
         List<Object> tokensForPdfbox = streamParser.getTokens();

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDSquareAnnotationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDSquareAnnotationTest.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDSquareAnnotationTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDSquareAnnotationTest.java
Mon Jun  4 18:03:52 2018
@@ -137,7 +137,7 @@ public class PDSquareAnnotationTest
             // test the content of the appearance stream
             PDStream contentStream = appearanceStream.getContentStream();
             assertNotNull("Content stream shall not be null", contentStream);
-            PDFStreamParser parser = new PDFStreamParser(appearanceStream);
+            PDFStreamParser parser = new PDFStreamParser(appearanceStream.getContents());
             parser.parse();
             List<Object> tokens = parser.getTokens();
             

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/ControlCharacterTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/ControlCharacterTest.java?rev=1832873&r1=1832872&r2=1832873&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/ControlCharacterTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/ControlCharacterTest.java
Mon Jun  4 18:03:52 2018
@@ -175,7 +175,8 @@ public class ControlCharacterTest {
     private List<String> getStringsFromStream(PDField field) throws IOException
     {
     	PDAnnotationWidget widget = field.getWidgets().get(0);
-    	PDFStreamParser parser = new PDFStreamParser(widget.getNormalAppearanceStream());
+        PDFStreamParser parser = new PDFStreamParser(
+                widget.getNormalAppearanceStream().getContents());
     	
     	Object token = parser.parseNextToken();
     	



Mime
View raw message