Author: nextgens
Date: 2007-02-21 20:04:44 +0000 (Wed, 21 Feb 2007)
New Revision: 11885

Modified:
   trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java
Log:
Patch from Anonymous at o9_0DTuZniSf_+oDmRsonByWxsI: InputStream returns -1 on 
EOF; ReadOnlyFileSliceBucket ought to do the same

Modified: trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java   
2007-02-21 19:26:09 UTC (rev 11884)
+++ trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java   
2007-02-21 20:04:44 UTC (rev 11885)
@@ -3,7 +3,6 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.support.io;

-import java.io.EOFException;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -93,7 +92,7 @@

                public int read() throws IOException {
                        if(ptr >= length)
-                               throw new EOFException();
+                               return -1;
                        int x = f.read();
                        if(x != -1) ptr++;
                        return x;
@@ -101,7 +100,7 @@

                public int read(byte[] buf, int offset, int len) throws 
IOException {
                        if(ptr >= length)
-                               throw new EOFException();
+                               return -1;
                        len = (int) Math.min(len, length - ptr);
                        int x = f.read(buf, offset, len);
                        ptr += x;


Reply via email to