aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/gnu/java')
-rw-r--r--libjava/gnu/java/nio/DatagramChannelImpl.java5
-rw-r--r--libjava/gnu/java/nio/DatagramChannelSelectionKey.java59
-rw-r--r--libjava/gnu/java/nio/SelectionKeyImpl.java8
-rw-r--r--libjava/gnu/java/nio/SocketChannelImpl.java5
-rw-r--r--libjava/gnu/java/nio/SocketChannelSelectionKey.java56
5 files changed, 129 insertions, 4 deletions
diff --git a/libjava/gnu/java/nio/DatagramChannelImpl.java b/libjava/gnu/java/nio/DatagramChannelImpl.java
index a4f46df..b2dcd32 100644
--- a/libjava/gnu/java/nio/DatagramChannelImpl.java
+++ b/libjava/gnu/java/nio/DatagramChannelImpl.java
@@ -64,6 +64,11 @@ public final class DatagramChannelImpl extends DatagramChannel
super (provider);
socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this);
}
+
+ public int getNativeFD()
+ {
+ return socket.getImpl().getNativeFD();
+ }
public DatagramSocket socket ()
{
diff --git a/libjava/gnu/java/nio/DatagramChannelSelectionKey.java b/libjava/gnu/java/nio/DatagramChannelSelectionKey.java
new file mode 100644
index 0000000..33f8123
--- /dev/null
+++ b/libjava/gnu/java/nio/DatagramChannelSelectionKey.java
@@ -0,0 +1,59 @@
+/* DatagramChannelSelectionKey.java --
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.nio;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+
+/**
+ * @author Michael Koch
+ */
+public final class DatagramChannelSelectionKey
+ extends SelectionKeyImpl
+{
+ public DatagramChannelSelectionKey (AbstractSelectableChannel channel,
+ SelectorImpl selector)
+ {
+ super (channel, selector);
+ }
+
+ public int getNativeFD()
+ {
+ return ((DatagramChannelImpl) ch).getNativeFD();
+ }
+}
diff --git a/libjava/gnu/java/nio/SelectionKeyImpl.java b/libjava/gnu/java/nio/SelectionKeyImpl.java
index df4faa3..0f704c9 100644
--- a/libjava/gnu/java/nio/SelectionKeyImpl.java
+++ b/libjava/gnu/java/nio/SelectionKeyImpl.java
@@ -43,19 +43,17 @@ import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.spi.AbstractSelectionKey;
-public class SelectionKeyImpl extends AbstractSelectionKey
+public abstract class SelectionKeyImpl extends AbstractSelectionKey
{
- int fd;
private int readyOps;
private int interestOps;
private SelectorImpl impl;
private SelectableChannel ch;
- public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl, int fd)
+ public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl)
{
this.ch = ch;
this.impl = impl;
- this.fd = fd;
}
public SelectableChannel channel ()
@@ -101,4 +99,6 @@ public class SelectionKeyImpl extends AbstractSelectionKey
{
return impl;
}
+
+ public abstract int getNativeFD();
}
diff --git a/libjava/gnu/java/nio/SocketChannelImpl.java b/libjava/gnu/java/nio/SocketChannelImpl.java
index a114b06..589296f5 100644
--- a/libjava/gnu/java/nio/SocketChannelImpl.java
+++ b/libjava/gnu/java/nio/SocketChannelImpl.java
@@ -98,6 +98,11 @@ public final class SocketChannelImpl extends SocketChannel
}
}
+ int getNativeFD()
+ {
+ return socket.getImpl().getNativeFD();
+ }
+
protected void implCloseSelectableChannel () throws IOException
{
connected = false;
diff --git a/libjava/gnu/java/nio/SocketChannelSelectionKey.java b/libjava/gnu/java/nio/SocketChannelSelectionKey.java
new file mode 100644
index 0000000..dcbc7bd
--- /dev/null
+++ b/libjava/gnu/java/nio/SocketChannelSelectionKey.java
@@ -0,0 +1,56 @@
+/* SocketChannelSelectionKey.java --
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.nio;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+
+public final class SocketChannelSelectionKey
+ extends SelectionKeyImpl
+{
+ public SocketChannelSelectionKey (AbstractSelectableChannel channel,
+ SelectorImpl selector)
+ {
+ super (channel, selector);
+ }
+
+ public int getNativeFD()
+ {
+ return ((SocketChannelImpl) ch).getNativeFD();
+ }
+}