pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1760167 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter: COSStandardOutputStream.java COSWriter.java
Date Sat, 10 Sep 2016 13:47:50 GMT
Author: tilman
Date: Sat Sep 10 13:47:50 2016
New Revision: 1760167

URL: http://svn.apache.org/viewvc?rev=1760167&view=rev
Log:
PDFBOX-3065: remove deprecated constructor; remove unused variables; remove super(); integrate
initWriter() into constructor; change COSStandardOutputStream constructor parameter

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSStandardOutputStream.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSStandardOutputStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSStandardOutputStream.java?rev=1760167&r1=1760166&r2=1760167&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSStandardOutputStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSStandardOutputStream.java
Sat Sep 10 13:47:50 2016
@@ -64,7 +64,7 @@ public class COSStandardOutputStream ext
      * @param out The underlying stream to write to.
      * @param position The current position of output stream.
      */
-    public COSStandardOutputStream(OutputStream out, int position)
+    public COSStandardOutputStream(OutputStream out, long position)
     {
         super(out);
         this.position = position;

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1760167&r1=1760166&r2=1760167&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Sat Sep 10
13:47:50 2016
@@ -59,7 +59,6 @@ import org.apache.pdfbox.cos.COSString;
 import org.apache.pdfbox.cos.COSUpdateInfo;
 import org.apache.pdfbox.cos.ICOSVisitor;
 import org.apache.pdfbox.io.IOUtils;
-import org.apache.pdfbox.io.RandomAccessBuffer;
 import org.apache.pdfbox.io.RandomAccessInputStream;
 import org.apache.pdfbox.io.RandomAccessRead;
 import org.apache.pdfbox.pdfparser.PDFXRefStream;
@@ -168,8 +167,6 @@ public class COSWriter implements ICOSVi
     private final NumberFormat formatXrefGeneration = new DecimalFormat("00000",
             DecimalFormatSymbols.getInstance(Locale.US));
 
-    private final NumberFormat formatDecimal = NumberFormat.getNumberInstance( Locale.US
);
-
     // the stream where we create the pdf output
     private OutputStream output;
 
@@ -218,7 +215,6 @@ public class COSWriter implements ICOSVi
     private long signatureOffset, signatureLength;
     private long byteRangeOffset, byteRangeLength;
     private RandomAccessRead incrementalInput;
-    private RandomAccessRead tempIncInput;
     private OutputStream incrementalOutput;
     private SignatureInterface signatureInterface;
     private byte[] incrementPart;
@@ -230,27 +226,8 @@ public class COSWriter implements ICOSVi
      */
     public COSWriter(OutputStream os)
     {
-        super();
         setOutput(os);
         setStandardOutput(new COSStandardOutputStream(output));
-        formatDecimal.setMaximumFractionDigits( 10 );
-        formatDecimal.setGroupingUsed( false );
-    }
-    
-    /**
-     * COSWriter constructor for incremental updates. 
-     *
-     * @param outputStream output stream where the new PDF data will be written
-     * @param inputStream input stream containing source PDF data
-     * 
-     * @throws IOException if something went wrong
-     * @deprecated Use {@link #COSWriter(OutputStream, RandomAccessRead)} instead
-     */
-    public COSWriter(OutputStream outputStream, InputStream inputStream) throws IOException
-    {
-        super();
-        tempIncInput = new RandomAccessBuffer(inputStream);
-        initWriter(outputStream, tempIncInput);
     }
 
     /**
@@ -263,22 +240,13 @@ public class COSWriter implements ICOSVi
      */
     public COSWriter(OutputStream outputStream, RandomAccessRead inputData) throws IOException
     {
-        super();
-        initWriter(outputStream, inputData);
-    }
-
-    private void initWriter(OutputStream outputStream, RandomAccessRead inputData) throws
IOException
-    {
         // write to buffer instead of output
         setOutput(new ByteArrayOutputStream());
-        setStandardOutput(new COSStandardOutputStream(output, (int)inputData.length()));
+        setStandardOutput(new COSStandardOutputStream(output, inputData.length()));
 
         incrementalInput = inputData;
         incrementalOutput = outputStream;
         incrementalUpdate = true;
-
-        formatDecimal.setMaximumFractionDigits( 10 );
-        formatDecimal.setGroupingUsed( false );
     }
 
     private void prepareIncrement(PDDocument doc)
@@ -349,10 +317,6 @@ public class COSWriter implements ICOSVi
         {
             incrementalOutput.close();
         }
-        if (tempIncInput != null)
-        {
-            incrementalOutput.close();
-        }
     }
 
     /**



Mime
View raw message