FileInputStream.java (skip): Call fd.getFilePointer() and calculate correct number...
authorBryce McKinlay <bryce@waitaki.otago.ac.nz>
Mon, 25 Mar 2002 02:01:29 +0000 (02:01 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Mon, 25 Mar 2002 02:01:29 +0000 (02:01 +0000)
* java/io/FileInputStream.java (skip): Call fd.getFilePointer() and
calculate correct number of bytes skipped.

From-SVN: r51293

libjava/ChangeLog
libjava/java/io/FileInputStream.java

index 322b39afa2265b3b28f817da9b048633190117f0..0b15ae640a6a6e7567be9592ee359419113d19ee 100644 (file)
@@ -2,6 +2,9 @@
 
        * java/io/PushbackReader.java: Reformat.
 
+       * java/io/FileInputStream.java (skip): Call fd.getFilePointer() and
+       calculate correct number of bytes skipped.
+
 2002-03-24  Tom Tromey  <tromey@redhat.com>
 
        * java/awt/TextComponent.java (TextComponent): Editable by
index 9d0d0133b9cf76a102d9a21bd122b494d7a192c8..6a02d2ba862e10237251d3e0288fa47e0bfd0556 100644 (file)
@@ -88,6 +88,8 @@ public class FileInputStream extends InputStream
 
   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;
   }
 }