15 |
{ |
{ |
16 |
} |
} |
17 |
|
|
18 |
static DatagramChannel open() throws IOException |
public static DatagramChannel open() throws IOException |
19 |
{ |
{ |
20 |
return SelectorProvider.provider().openDatagramChannel(); |
return SelectorProvider.provider().openDatagramChannel(); |
21 |
} |
} |
22 |
|
|
23 |
long read(ByteBuffer[] dsts) |
public long read(ByteBuffer[] dsts) |
24 |
{ |
{ |
25 |
long b = 0; |
long b = 0; |
26 |
for (int i=0;i<dsts.length;i++) |
for (int i=0;i<dsts.length;i++) |
28 |
return b; |
return b; |
29 |
} |
} |
30 |
|
|
31 |
abstract DatagramChannel connect(SocketAddress remote); |
public abstract DatagramChannel connect(SocketAddress remote); |
32 |
abstract DatagramChannel disconnect(); |
public abstract DatagramChannel disconnect(); |
33 |
abstract boolean isConnected(); |
public abstract boolean isConnected(); |
34 |
abstract public int read(ByteBuffer dst); |
public abstract int read(ByteBuffer dst); |
35 |
abstract long read(ByteBuffer[] dsts, int offset, int length); |
public abstract long read(ByteBuffer[] dsts, int offset, int length); |
36 |
abstract SocketAddress receive(ByteBuffer dst); |
public abstract SocketAddress receive(ByteBuffer dst); |
37 |
abstract int send(ByteBuffer src, SocketAddress target); |
public abstract int send(ByteBuffer src, SocketAddress target); |
38 |
abstract DatagramSocket socket(); |
public abstract DatagramSocket socket(); |
39 |
abstract public int write(ByteBuffer src); |
public abstract int write(ByteBuffer src); |
40 |
abstract public long write(ByteBuffer[] srcs, int offset, int length); |
public abstract long write(ByteBuffer[] srcs, int offset, int length); |
41 |
|
|
42 |
int validOps() |
public int validOps() |
43 |
{ |
{ |
44 |
return SelectionKey.OP_READ | SelectionKey.OP_WRITE; |
return SelectionKey.OP_READ | SelectionKey.OP_WRITE; |
45 |
} |
} |
46 |
|
|
47 |
public long write(ByteBuffer[] dsts) |
public int write(ByteBuffer[] dsts) |
48 |
{ |
{ |
49 |
long b = 0; |
long b = 0; |
50 |
for (int i=0;i<dsts.length;i++) |
for (int i=0;i<dsts.length;i++) |
51 |
b += write(dsts[i]); |
b += write(dsts[i]); |
52 |
return b; |
return (int)b; |
53 |
} |
} |
54 |
} |
} |
55 |
|
|