aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/FileInputStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/io/FileInputStream.java')
-rw-r--r--libjava/java/io/FileInputStream.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java
index b49922e..e22a23a 100644
--- a/libjava/java/io/FileInputStream.java
+++ b/libjava/java/io/FileInputStream.java
@@ -82,6 +82,7 @@ public class FileInputStream extends InputStream
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkRead(name);
+
fd = new FileDescriptor(name, FileDescriptor.READ);
}
@@ -268,15 +269,15 @@ public class FileInputStream extends InputStream
*
* @exception IOException If an error occurs
*/
- public long skip (long numBytes) throws IOException
+ public synchronized long skip (long numBytes) throws IOException
{
if (numBytes < 0)
- throw new IllegalArgumentException ( "Can't skip negative bytes: " +
- numBytes);
+ 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;