pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1676346 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io: RandomAccess.java RandomAccessFile.java
Date Mon, 27 Apr 2015 17:51:41 GMT
Author: lehmi
Date: Mon Apr 27 17:51:41 2015
New Revision: 1676346

URL: http://svn.apache.org/r1676346
Log:
PDFBOX-2301: implemented clear() for RandomAccessFile

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessFile.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java?rev=1676346&r1=1676345&r2=1676346&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccess.java Mon Apr 27 17:51:41
2015
@@ -48,5 +48,5 @@ public interface RandomAccess extends Ra
     /**
      * Clears all data of the buffer.
      */
-    void clear();
+    void clear() throws IOException;
 }

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=1676346&r1=1676345&r2=1676346&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 Mon Apr 27
17:51:41 2015
@@ -58,9 +58,10 @@ public class RandomAccessFile implements
      * {@inheritDoc}
      */
     @Override
-    public void clear()
+    public void clear() throws IOException
     {
-        throw new java.lang.UnsupportedOperationException(RandomAccessFile.class.getName()+"clear()
isn't yet supported");
+        ras.seek(0);
+        ras.setLength(0);
     }
 
     /**
@@ -80,7 +81,7 @@ public class RandomAccessFile implements
     {
         return ras.getFilePointer();
     }
-    
+
     /**
      * {@inheritDoc}
      */



Mime
View raw message