2002-11-01 Michael Koch <konqueror@gmx.de>
[official-gcc.git] / libjava / java / nio / channels / SelectionKey.java
blob6835d1d99db8f8c73a42c2b79289714c59824cf1
1 /* SelectionKey.java --
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package java.nio.channels;
40 public abstract class SelectionKey
42 public static final int OP_ACCEPT = 1<<0;
43 public static final int OP_CONNECT = 1<<1;
44 public static final int OP_READ = 1<<2;
45 public static final int OP_WRITE = 1<<3;
47 Object attached;
49 protected SelectionKey()
53 public final Object attach(Object obj)
55 Object old = attached;
56 attached = obj;
57 return old;
60 public final Object attachment()
62 return attached;
65 /**
66 * @exception CancelledKeyException FIXME
68 public final boolean isAcceptable()
70 return (readyOps() & OP_ACCEPT) != 0;
73 /**
74 * @exception CancelledKeyException FIXME
76 public final boolean isConnectable()
78 return (readyOps() & OP_CONNECT) != 0;
81 /**
82 * @exception CancelledKeyException FIXME
84 public final boolean isReadable()
86 return (readyOps() & OP_READ) != 0;
89 /**
90 * @exception CancelledKeyException FIXME
92 public final boolean isWritable()
94 return (readyOps() & OP_WRITE) != 0;
97 public abstract void cancel();
99 public abstract SelectableChannel channel();
102 * @exception CancelledKeyException FIXME
104 public abstract int interestOps();
107 * @exception CancelledKeyException FIXME
108 * @exception IllegalArgumentException FIXME
110 public abstract SelectionKey interestOps(int ops);
112 public abstract boolean isValid();
115 * @exception CancelledKeyException FIXME
117 public abstract int readyOps();
119 public abstract Selector selector();