diff options
Diffstat (limited to 'libjava/classpath/java/io/FileInputStream.java')
-rw-r--r-- | libjava/classpath/java/io/FileInputStream.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libjava/classpath/java/io/FileInputStream.java b/libjava/classpath/java/io/FileInputStream.java index 8ca38b02fc4..8217668b479 100644 --- a/libjava/classpath/java/io/FileInputStream.java +++ b/libjava/classpath/java/io/FileInputStream.java @@ -38,8 +38,9 @@ exception statement from your version. */ package java.io; -import gnu.java.nio.channels.FileChannelImpl; +import gnu.java.nio.FileChannelImpl; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -107,7 +108,20 @@ public class FileInputStream extends InputStream if (s != null) s.checkRead(file.getPath()); - ch = FileChannelImpl.create(file, FileChannelImpl.READ); + try + { + ch = FileChannelImpl.create(file, FileChannelImpl.READ); + } + catch (FileNotFoundException fnfe) + { + throw fnfe; + } + catch (IOException ioe) + { + FileNotFoundException fnfe = new FileNotFoundException(file.getPath()); + fnfe.initCause(ioe); + throw fnfe; + } } /** @@ -266,7 +280,7 @@ public class FileInputStream extends InputStream || offset + len > buf.length) throw new ArrayIndexOutOfBoundsException(); - return ch.read(buf, offset, len); + return ch.read(ByteBuffer.wrap(buf, offset, len)); } /** |