This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Patch: java.io.FileInputStream.skip()


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I commited the attached patch to trunk to merge 
java.io.FileInputStream.skip() with classpath.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+kIW2WSOgCCdjSDsRAjI+AJ4sTKfQDqM2IKPyNYsQ6PKbetWdMgCfdttH
ZuZoWnh8eF/NH1n04jc2k6Y=
=f7Wi
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1838
diff -u -r1.1838 ChangeLog
--- ChangeLog	31 Mar 2003 12:19:21 -0000	1.1838
+++ ChangeLog	6 Apr 2003 15:49:23 -0000
@@ -1,3 +1,9 @@
+2003-04-06  Michael Koch  <konqueror at gmx dot de>
+
+	* java/io/FileInputStream.java
+	(skip): Renamed some variables to match classpath, added
+	checks from classpath.
+
 2003-03-31  Michael Koch  <konqueror at gmx dot de>
 
 	* javax/swing/AbstractAction.java
Index: java/io/FileInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FileInputStream.java,v
retrieving revision 1.15
diff -u -r1.15 FileInputStream.java
--- java/io/FileInputStream.java	25 Mar 2003 13:06:52 -0000	1.15
+++ java/io/FileInputStream.java	6 Apr 2003 15:49:23 -0000
@@ -268,11 +268,18 @@
    *
    * @exception IOException If an error occurs
    */
-  public long skip(long n) throws IOException
+  public long skip (long numBytes) throws IOException
   {
-    long startPos = fd.getFilePointer();
-    long endPos = fd.seek(n, FileDescriptor.CUR, true);
-    return endPos - startPos;
+    if (numBytes < 0)
+      throw new IllegalArgumentException ( "Can't skip negative bytes: " +
+                                           numBytes);
+
+    if (numBytes == 0)
+      return 0;
+    
+    long curPos = fd.getFilePointer ();
+    long newPos = fd.seek (numBytes, FileDescriptor.CUR, true);
+    return newPos - curPos;
   }
 
   /**

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]