pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1589459 - in /pdfbox/trunk: fontbox/src/main/java/org/apache/fontbox/ttf/ pdfbox/src/main/java/org/apache/pdfbox/cos/ pdfbox/src/main/java/org/apache/pdfbox/io/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/ pdfbox/src/main/java/org/...
Date Wed, 23 Apr 2014 17:29:26 GMT
Author: tilman
Date: Wed Apr 23 17:29:26 2014
New Revision: 1589459

URL: http://svn.apache.org/r1589459
Log:
PDFBOX-2039: implement Closeable as suggested by Andrei Solntsev

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessFile.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightContext.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java Wed Apr 23
17:29:26 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.fontbox.ttf;
 
+import java.io.Closeable;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -28,7 +29,7 @@ import java.util.GregorianCalendar;
  * @author Ben Litchfield (ben@benlitchfield.com)
  * 
  */
-public abstract class TTFDataStream
+public abstract class TTFDataStream implements Closeable
 {
 
     /**
@@ -205,6 +206,7 @@ public abstract class TTFDataStream
      * 
      * @throws IOException If there is an error closing the resources.
      */
+    @Override
     public abstract void close() throws IOException;
 
     /**

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java Wed Apr 23 17:29:26
2014
@@ -19,6 +19,7 @@ package org.apache.pdfbox.cos;
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
+import java.io.Closeable;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -42,7 +43,7 @@ import org.apache.pdfbox.pdfparser.PDFSt
  *
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  */
-public class COSStream extends COSDictionary
+public class COSStream extends COSDictionary implements Closeable
 {
     /**
      * Log instance.

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java Wed Apr
23 17:29:26 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.io;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 
@@ -24,7 +25,7 @@ import java.util.ArrayList;
  * The data will be stored in 16kb chunks organized in an ArrayList.  
  *
  */
-public class RandomAccessBuffer implements RandomAccess
+public class RandomAccessBuffer implements RandomAccess, Closeable
 {
     // chunk size is 16kb
     private static final int BUFFER_SIZE = 16384;
@@ -86,6 +87,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public void close() throws IOException
     {
         currentBuffer = null;
@@ -99,6 +101,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public void seek(long position) throws IOException
     {
         checkClosed();
@@ -112,6 +115,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public long getPosition() throws IOException {
        checkClosed();
        return pointer;
@@ -120,6 +124,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public int read() throws IOException
     {
         checkClosed();
@@ -146,6 +151,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public int read(byte[] b, int offset, int length) throws IOException
     {
         checkClosed();
@@ -190,6 +196,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public long length() throws IOException
     {
         checkClosed();
@@ -199,6 +206,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public void write(int b) throws IOException
     {
         checkClosed();
@@ -231,6 +239,7 @@ public class RandomAccessBuffer implemen
     /**
      * {@inheritDoc}
      */
+    @Override
     public void write(byte[] b, int offset, int length) throws IOException
     {
         checkClosed();

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessFile.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessFile.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessFile.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessFile.java Wed Apr 23
17:29:26 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.io;
 
+import java.io.Closeable;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -27,7 +28,7 @@ import java.io.IOException;
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.2 $
  */
-public class RandomAccessFile implements RandomAccess
+public class RandomAccessFile implements RandomAccess, Closeable
 {
     private java.io.RandomAccessFile ras;
 
@@ -46,6 +47,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public void close() throws IOException
     {
         ras.close();
@@ -54,6 +56,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public void seek(long position) throws IOException
     {
         ras.seek(position);
@@ -62,6 +65,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public long getPosition() throws IOException {
         return ras.getFilePointer();
     }
@@ -69,6 +73,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public int read() throws IOException
     {
         return ras.read();
@@ -77,6 +82,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public int read(byte[] b, int offset, int length) throws IOException
     {
         return ras.read(b, offset, length);
@@ -85,6 +91,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public long length() throws IOException
     {
         return ras.length();
@@ -93,6 +100,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public void write(byte[] b, int offset, int length) throws IOException
     {
         ras.write(b, offset, length);
@@ -101,6 +109,7 @@ public class RandomAccessFile implements
     /**
      * {@inheritDoc}
      */
+    @Override
     public void write(int b) throws IOException
     {
         ras.write(b);

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
Wed Apr 23 17:29:26 2014
@@ -21,6 +21,7 @@ import java.awt.color.ColorSpace;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.PathIterator;
 import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
@@ -58,7 +59,7 @@ import org.apache.pdfbox.pdmodel.graphic
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * 
  */
-public class PDPageContentStream
+public class PDPageContentStream implements Closeable
 {
     /**
      * Log instance.

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java Wed Apr
23 17:29:26 2014
@@ -18,6 +18,7 @@ package org.apache.pdfbox.pdmodel.fdf;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedWriter;
+import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -45,7 +46,7 @@ import org.w3c.dom.Element;
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.6 $
  */
-public class FDFDocument
+public class FDFDocument implements Closeable
 {
     private COSDocument document;
 

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightContext.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightContext.java?rev=1589459&r1=1589458&r2=1589459&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightContext.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightContext.java
Wed Apr 23 17:29:26 2014
@@ -21,10 +21,10 @@
 
 package org.apache.pdfbox.preflight;
 
+import java.io.Closeable;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.SortedMap;
 
 import javax.activation.DataSource;
 
@@ -36,7 +36,7 @@ import org.apache.pdfbox.preflight.graph
 import org.apache.pdfbox.preflight.utils.COSUtils;
 import org.apache.xmpbox.XMPMetadata;
 
-public class PreflightContext
+public class PreflightContext implements Closeable
 {
     /**
      * Contains the list of font name embedded in the PDF document.



Mime
View raw message