pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1684032 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBufferedFileInputStream.java
Date Sun, 07 Jun 2015 13:09:38 GMT
Author: lehmi
Date: Sun Jun  7 13:09:38 2015
New Revision: 1684032

URL: http://svn.apache.org/r1684032
Log:
PDFBOX-2301: call seek to initialize all member values

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBufferedFileInputStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBufferedFileInputStream.java?rev=1684032&r1=1684031&r2=1684032&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBufferedFileInputStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBufferedFileInputStream.java
Sun Jun  7 13:09:38 2015
@@ -82,25 +82,24 @@ extends InputStream implements RandomAcc
      * Create a random access input stream instance for the file with the given name.
      *
      * @param filename the filename of the file to be read.
-     * @throws FileNotFoundException if the given file can't be found.
+     * @throws IOException if something went wrong while accessing the given file.
      */
-    public RandomAccessBufferedFileInputStream( String filename ) throws FileNotFoundException

+    public RandomAccessBufferedFileInputStream( String filename ) throws IOException 
     {
-        File file = new File(filename);
-        raFile = new RandomAccessFile(file, "r");
-        fileLength = file.length();
+        this(new File(filename));
     }
 
     /** 
      * Create a random access input stream instance for the given file.
      *
      * @param file the file to be read.
-     * @throws FileNotFoundException if the given file can't be found.
+     * @throws IOException if something went wrong while accessing the given file.
      */
-    public RandomAccessBufferedFileInputStream( File file ) throws FileNotFoundException

+    public RandomAccessBufferedFileInputStream( File file ) throws IOException 
     {
         raFile = new RandomAccessFile(file, "r");
         fileLength = file.length();
+        seek(0);
     }
 
     /**
@@ -115,6 +114,7 @@ extends InputStream implements RandomAcc
         tempFile = createTmpFile(input);
         fileLength = tempFile.length();
         raFile = new RandomAccessFile(tempFile, "r");
+        seek(0);
     }
 
     private File createTmpFile(InputStream input) throws IOException



Mime
View raw message