This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FileInputStream.skip() fix
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 25 Mar 2002 13:57:15 +1200
- Subject: FileInputStream.skip() fix
FileInputStream.skip() is supposed to return the actual number of bytes
skipped, but ours was returning the current position in the file. This
patch fixes.
Bryce.
* java/io/FileInputStream.java (skip): Call fd.getFilePointer() and
calculate correct number of bytes skipped.
Index: java/io/FileInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FileInputStream.java,v
retrieving revision 1.6
diff -u -r1.6 FileInputStream.java
--- FileInputStream.java 2001/08/02 23:46:39 1.6
+++ FileInputStream.java 2002/03/25 01:55:26
@@ -88,6 +88,8 @@
public long skip(long n) throws IOException
{
- return n <= 0 ? 0 : fd.seek(n, FileDescriptor.CUR, true);
+ long startPos = fd.getFilePointer();
+ long endPos = fd.seek(n, FileDescriptor.CUR, true);
+ return endPos - startPos;
}
}