1 |
/* SelectionKeyImpl.java -- |
/* SelectionKeyImpl.java -- |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
37 |
|
|
38 |
package gnu.java.nio; |
package gnu.java.nio; |
39 |
|
|
40 |
|
import java.nio.channels.CancelledKeyException; |
41 |
import java.nio.channels.SelectableChannel; |
import java.nio.channels.SelectableChannel; |
42 |
import java.nio.channels.SelectionKey; |
import java.nio.channels.SelectionKey; |
43 |
import java.nio.channels.Selector; |
import java.nio.channels.Selector; |
46 |
public class SelectionKeyImpl extends AbstractSelectionKey |
public class SelectionKeyImpl extends AbstractSelectionKey |
47 |
{ |
{ |
48 |
int fd; |
int fd; |
49 |
int readyOps; |
private int readyOps; |
50 |
int interestOps; |
private int interestOps; |
51 |
SelectorImpl impl; |
private SelectorImpl impl; |
52 |
SelectableChannel ch; |
private SelectableChannel ch; |
53 |
|
|
54 |
public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl, int fd) |
public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl, int fd) |
55 |
{ |
{ |
65 |
|
|
66 |
public int readyOps () |
public int readyOps () |
67 |
{ |
{ |
68 |
|
if (!isValid()) |
69 |
|
throw new CancelledKeyException(); |
70 |
|
|
71 |
return readyOps; |
return readyOps; |
72 |
} |
} |
73 |
|
|
74 |
public SelectionKey readyOps (int ops) |
public SelectionKey readyOps (int ops) |
75 |
{ |
{ |
76 |
|
if (!isValid()) |
77 |
|
throw new CancelledKeyException(); |
78 |
|
|
79 |
readyOps = ops; |
readyOps = ops; |
80 |
return this; |
return this; |
81 |
} |
} |
82 |
|
|
83 |
public int interestOps () |
public int interestOps () |
84 |
{ |
{ |
85 |
|
if (!isValid()) |
86 |
|
throw new CancelledKeyException(); |
87 |
|
|
88 |
return interestOps; |
return interestOps; |
89 |
} |
} |
90 |
|
|
91 |
public SelectionKey interestOps (int ops) |
public SelectionKey interestOps (int ops) |
92 |
{ |
{ |
93 |
|
if (!isValid()) |
94 |
|
throw new CancelledKeyException(); |
95 |
|
|
96 |
interestOps = ops; |
interestOps = ops; |
97 |
return this; |
return this; |
98 |
} |
} |