123
|
1 package rep.channel;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import java.nio.channels.ClosedChannelException;
|
|
5 import java.nio.channels.SelectableChannel;
|
|
6 import java.nio.channels.SelectionKey;
|
|
7 import java.nio.channels.Selector;
|
|
8 import java.nio.channels.SocketChannel;
|
|
9 import java.nio.channels.spi.SelectorProvider;
|
|
10
|
|
11 public class REPSocketChannel<P> extends SelectableChannel{
|
|
12
|
|
13 private SocketChannel sc;
|
|
14
|
|
15 public REPSocketChannel(SocketChannel channel) {
|
|
16 sc = channel;
|
|
17 }
|
|
18
|
|
19 @Override
|
|
20 public Object blockingLock() {
|
|
21 return sc.blockingLock();
|
|
22 }
|
|
23
|
|
24 @Override
|
|
25 public SelectableChannel configureBlocking(boolean block) throws IOException {
|
|
26 return sc.configureBlocking(block);
|
|
27 }
|
|
28
|
|
29 @Override
|
|
30 public boolean isBlocking() {
|
|
31 return sc.isBlocking();
|
|
32 }
|
|
33
|
|
34 @Override
|
|
35 public boolean isRegistered() {
|
|
36 return sc.isRegistered();
|
|
37 }
|
|
38
|
|
39 @Override
|
|
40 public SelectionKey keyFor(Selector sel) {
|
|
41 return sc.keyFor(sel);
|
|
42 }
|
|
43
|
|
44 @Override
|
|
45 public SelectorProvider provider() {
|
|
46 return sc.provider();
|
|
47 }
|
|
48
|
|
49 @Override
|
|
50 public SelectionKey register(Selector sel, int ops, Object att) throws ClosedChannelException {
|
|
51 return sc.register(sel, ops, att);
|
|
52 }
|
|
53
|
|
54 @Override
|
|
55 public int validOps() {
|
|
56 return sc.validOps();
|
|
57 }
|
|
58
|
|
59 @Override
|
|
60 protected void implCloseChannel() throws IOException {
|
|
61 sc.close();
|
|
62 }
|
|
63
|
|
64
|
|
65
|
|
66 } |