summaryrefslogtreecommitdiff
path: root/gnu/java/nio/channels
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2005-07-25 13:57:39 +0000
committerRoman Kennke <roman@kennke.org>2005-07-25 13:57:39 +0000
commit1437bd37b161861ab2591ed02bc5792a080b35cb (patch)
tree6279d56f90083e178506ab25cb24edb62d117da9 /gnu/java/nio/channels
parentc784be01c80a68eae3d351cb5d7daad07499d055 (diff)
downloadclasspath-1437bd37b161861ab2591ed02bc5792a080b35cb.tar.gz
2005-07-25 Roman Kennke <roman@kennke.org>
* 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.
Diffstat (limited to 'gnu/java/nio/channels')
-rw-r--r--gnu/java/nio/channels/FileChannelImpl.java22
1 files changed, 17 insertions, 5 deletions
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;