summaryrefslogtreecommitdiff
path: root/libjava/java/io/FileOutputStream.java
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-20 07:54:24 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-20 07:54:24 +0000
commitff0263c808951d22e7f0324fd28877cf4f6a1fab (patch)
treec99af8765e9410ed162e184496445f198dee0afc /libjava/java/io/FileOutputStream.java
parent2653f9df5503bdf69f827ea82909a623484605a3 (diff)
downloadgcc-ff0263c808951d22e7f0324fd28877cf4f6a1fab.tar.gz
2003-03-20 Michael Koch <konqueror@gmx.de>
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64609 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/FileOutputStream.java')
-rw-r--r--libjava/java/io/FileOutputStream.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java
index 1154a4b2806..eaf4d9beaa2 100644
--- a/libjava/java/io/FileOutputStream.java
+++ b/libjava/java/io/FileOutputStream.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.io;
import java.nio.channels.FileChannel;
+import gnu.java.nio.FileChannelImpl;
/**
* @author Tom Tromey <tromey@cygnus.com>
@@ -147,11 +148,18 @@ public class FileOutputStream extends OutputStream
fd.close();
}
- // Instance variables.
- private FileDescriptor fd;
-
public FileChannel getChannel ()
{
- return null;
+ synchronized (this)
+ {
+ if (ch == null)
+ ch = new FileChannelImpl (fd, true, this);
+
+ return ch;
+ }
}
+
+ // Instance variables.
+ private FileDescriptor fd;
+ private FileChannel ch;
}