1 |
package manta.runtime; |
package gnu.java.nio; |
2 |
|
|
3 |
import java.net.*; |
import java.net.*; |
4 |
import java.io.*; |
import java.io.*; |
24 |
static native int SocketRead(int fd, byte b[], int off, int len); |
static native int SocketRead(int fd, byte b[], int off, int len); |
25 |
static native int SocketWrite(int fd, byte b[], int off, int len); |
static native int SocketWrite(int fd, byte b[], int off, int len); |
26 |
|
|
27 |
|
public SocketChannelImpl(SelectorProvider provider) |
|
SocketChannelImpl(SelectorProvider provider) |
|
28 |
{ |
{ |
29 |
super(provider); |
super(provider); |
30 |
|
|
44 |
} |
} |
45 |
} |
} |
46 |
|
|
47 |
|
public int validOps() |
|
int validOps() |
|
48 |
{ |
{ |
49 |
return SelectionKey.OP_READ | SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT; |
return SelectionKey.OP_READ | SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT; |
50 |
} |
} |
62 |
return; |
return; |
63 |
} |
} |
64 |
|
|
65 |
boolean connect(SocketAddress remote) |
public boolean connect(SocketAddress remote) |
66 |
throws IOException |
throws IOException |
67 |
{ |
{ |
68 |
if (connected) |
if (connected) |
93 |
return blocking; |
return blocking; |
94 |
} |
} |
95 |
|
|
96 |
boolean finishConnect() |
public boolean finishConnect() |
97 |
{ |
{ |
98 |
return false; |
return false; |
99 |
} |
} |
100 |
|
|
101 |
boolean isConnected() |
public boolean isConnected() |
102 |
{ |
{ |
103 |
return connected; |
return connected; |
104 |
} |
} |
105 |
|
|
106 |
boolean isConnectionPending() |
public boolean isConnectionPending() |
107 |
{ |
{ |
108 |
if (blocking) |
if (blocking) |
109 |
return false; |
return false; |
110 |
return false; |
return false; |
111 |
} |
} |
112 |
Socket socket() |
|
113 |
|
public Socket socket() |
114 |
{ |
{ |
115 |
if (sock_object != null) |
if (sock_object != null) |
116 |
{ |
{ |
117 |
sock_object.ch = this; |
//sock_object.ch = this; |
118 |
} |
} |
119 |
return sock_object; |
return sock_object; |
120 |
} |
} |
121 |
|
|
122 |
|
|
123 |
int read(ByteBuffer dst) |
public int read(ByteBuffer dst) |
124 |
{ |
{ |
125 |
int bytes = 0; |
int bytes = 0; |
126 |
|
|
142 |
} |
} |
143 |
|
|
144 |
|
|
145 |
long read(ByteBuffer[] dsts, int offset, int length) |
public long read(ByteBuffer[] dsts, int offset, int length) |
146 |
{ |
{ |
147 |
long bytes = 0; |
long bytes = 0; |
148 |
for (int i=offset; i<length; i++) |
for (int i=offset; i<length; i++) |
153 |
} |
} |
154 |
|
|
155 |
|
|
156 |
int write(ByteBuffer src) |
public int write(ByteBuffer src) |
157 |
{ |
{ |
158 |
int bytes = 0; |
int bytes = 0; |
159 |
|
|
181 |
return bytes; |
return bytes; |
182 |
} |
} |
183 |
|
|
184 |
long write(ByteBuffer[] srcs, int offset, int length) |
public long write(ByteBuffer[] srcs, int offset, int length) |
185 |
{ |
{ |
186 |
long bytes = 0; |
long bytes = 0; |
187 |
for (int i=offset; i<length; i++) |
for (int i=offset; i<length; i++) |