From 1437bd37b161861ab2591ed02bc5792a080b35cb Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Mon, 25 Jul 2005 13:57:39 +0000 Subject: 2005-07-25 Roman Kennke * gnu/java/nio/channels/FileChannelImpl.java (static initializer): Init out, err and in here. * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c (Java_gnu_java_nio_channels_FileChannelImpl_init): Moved init code for in, out and err to Java code. --- gnu/java/nio/channels/FileChannelImpl.java | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'gnu/java/nio/channels') diff --git a/gnu/java/nio/channels/FileChannelImpl.java b/gnu/java/nio/channels/FileChannelImpl.java index a87a2e8c5..f3f60c3ec 100644 --- a/gnu/java/nio/channels/FileChannelImpl.java +++ b/gnu/java/nio/channels/FileChannelImpl.java @@ -73,6 +73,10 @@ public final class FileChannelImpl extends FileChannel public static final int SYNC = 16; public static final int DSYNC = 32; + public static FileChannelImpl in; + public static FileChannelImpl out; + public static FileChannelImpl err; + private static native void init(); static @@ -83,6 +87,10 @@ public final class FileChannelImpl extends FileChannel } init(); + + in = new FileChannelImpl(0,READ); + out = new FileChannelImpl(1,WRITE); + err = new FileChannelImpl(2,WRITE); } /** @@ -130,17 +138,21 @@ public final class FileChannelImpl extends FileChannel } } - /* Used by init() (native code) */ + /** + * Constructor for default channels in, out and err. + * + * Used by init() (native code). + * + * @param fd the file descriptor (0, 1, 2 for stdin, stdout, stderr). + * + * @param mode READ or WRITE + */ FileChannelImpl (int fd, int mode) { this.fd = fd; this.mode = mode; } - public static FileChannelImpl in; - public static FileChannelImpl out; - public static FileChannelImpl err; - private native int open (String path, int mode) throws FileNotFoundException; public native int available () throws IOException; -- cgit v1.2.1