From 10b33028a2a620bc2864fc8f939072599762a1e2 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Thu, 20 Mar 2003 07:54:24 +0000 Subject: 2003-03-20 Michael Koch * java/io/FileInputStream.java (getChannel): New implementation. * java/io/FileOutputStream.java (ch): New member variable. (getChannel): Implemented. * java/io/RandomAccessFile.java (RandomAccessFile): Throws FileNotFoundException instead of IOException. (getChannel): New method. (ch): New member variable. From-SVN: r64609 --- libjava/java/io/FileInputStream.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libjava/java/io/FileInputStream.java') diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java index bbc7f7c6840..dcda9d81e64 100644 --- a/libjava/java/io/FileInputStream.java +++ b/libjava/java/io/FileInputStream.java @@ -34,6 +34,7 @@ exception statement from your version. */ package java.io; import java.nio.channels.FileChannel; +import gnu.java.nio.FileChannelImpl; /** * @author Warren Levy @@ -124,6 +125,12 @@ public class FileInputStream extends InputStream public FileChannel getChannel () { - return ch; + synchronized (this) + { + if (ch == null) + ch = new FileChannelImpl (fd, false, this); + + return ch; + } } } -- cgit v1.2.1