189 * @return This selection key |
189 * @return This selection key |
190 * |
190 * |
191 * @throws IllegalArgumentException |
191 * @throws IllegalArgumentException |
192 * If a bit in the set does not correspond to an operation that |
192 * If a bit in the set does not correspond to an operation that |
193 * is supported by this key's channel, that is, if |
193 * is supported by this key's channel, that is, if |
194 * <tt>(ops & ~channel().validOps()) != 0</tt> |
194 * {@code (ops & ~channel().validOps()) != 0} |
195 * |
195 * |
196 * @throws CancelledKeyException |
196 * @throws CancelledKeyException |
197 * If this key has been cancelled |
197 * If this key has been cancelled |
198 */ |
198 */ |
199 public abstract SelectionKey interestOps(int ops); |
199 public abstract SelectionKey interestOps(int ops); |
270 * Tests whether this key's channel is ready for reading. |
270 * Tests whether this key's channel is ready for reading. |
271 * |
271 * |
272 * <p> An invocation of this method of the form <tt>k.isReadable()</tt> |
272 * <p> An invocation of this method of the form <tt>k.isReadable()</tt> |
273 * behaves in exactly the same way as the expression |
273 * behaves in exactly the same way as the expression |
274 * |
274 * |
275 * <blockquote><pre> |
275 * <blockquote><pre>{@code |
276 * k.readyOps() & OP_READ != 0</pre></blockquote> |
276 * k.readyOps() & OP_READ != 0 |
|
277 * }</pre></blockquote> |
277 * |
278 * |
278 * <p> If this key's channel does not support read operations then this |
279 * <p> If this key's channel does not support read operations then this |
279 * method always returns <tt>false</tt>. </p> |
280 * method always returns <tt>false</tt>. </p> |
280 * |
281 * |
281 * @return <tt>true</tt> if, and only if, |
282 * @return <tt>true</tt> if, and only if, |
282 * <tt>readyOps()</tt> <tt>&</tt> <tt>OP_READ</tt> is |
283 {@code readyOps() & OP_READ} is nonzero |
283 * nonzero |
|
284 * |
284 * |
285 * @throws CancelledKeyException |
285 * @throws CancelledKeyException |
286 * If this key has been cancelled |
286 * If this key has been cancelled |
287 */ |
287 */ |
288 public final boolean isReadable() { |
288 public final boolean isReadable() { |
293 * Tests whether this key's channel is ready for writing. |
293 * Tests whether this key's channel is ready for writing. |
294 * |
294 * |
295 * <p> An invocation of this method of the form <tt>k.isWritable()</tt> |
295 * <p> An invocation of this method of the form <tt>k.isWritable()</tt> |
296 * behaves in exactly the same way as the expression |
296 * behaves in exactly the same way as the expression |
297 * |
297 * |
298 * <blockquote><pre> |
298 * <blockquote><pre>{@code |
299 * k.readyOps() & OP_WRITE != 0</pre></blockquote> |
299 * k.readyOps() & OP_WRITE != 0 |
|
300 * }</pre></blockquote> |
300 * |
301 * |
301 * <p> If this key's channel does not support write operations then this |
302 * <p> If this key's channel does not support write operations then this |
302 * method always returns <tt>false</tt>. </p> |
303 * method always returns <tt>false</tt>. </p> |
303 * |
304 * |
304 * @return <tt>true</tt> if, and only if, |
305 * @return <tt>true</tt> if, and only if, |
305 * <tt>readyOps()</tt> <tt>&</tt> <tt>OP_WRITE</tt> |
306 * {@code readyOps() & OP_WRITE} is nonzero |
306 * is nonzero |
|
307 * |
307 * |
308 * @throws CancelledKeyException |
308 * @throws CancelledKeyException |
309 * If this key has been cancelled |
309 * If this key has been cancelled |
310 */ |
310 */ |
311 public final boolean isWritable() { |
311 public final boolean isWritable() { |
317 * finish, its socket-connection operation. |
317 * finish, its socket-connection operation. |
318 * |
318 * |
319 * <p> An invocation of this method of the form <tt>k.isConnectable()</tt> |
319 * <p> An invocation of this method of the form <tt>k.isConnectable()</tt> |
320 * behaves in exactly the same way as the expression |
320 * behaves in exactly the same way as the expression |
321 * |
321 * |
322 * <blockquote><pre> |
322 * <blockqoute><pre>{@code |
323 * k.readyOps() & OP_CONNECT != 0</pre></blockquote> |
323 * k.readyOps() & OP_CONNECT != 0 |
|
324 * }</pre></blockquote> |
324 * |
325 * |
325 * <p> If this key's channel does not support socket-connect operations |
326 * <p> If this key's channel does not support socket-connect operations |
326 * then this method always returns <tt>false</tt>. </p> |
327 * then this method always returns <tt>false</tt>. </p> |
327 * |
328 * |
328 * @return <tt>true</tt> if, and only if, |
329 * @return <tt>true</tt> if, and only if, |
329 * <tt>readyOps()</tt> <tt>&</tt> <tt>OP_CONNECT</tt> |
330 * {@code readyOps() & OP_CONNECT} is nonzero |
330 * is nonzero |
|
331 * |
331 * |
332 * @throws CancelledKeyException |
332 * @throws CancelledKeyException |
333 * If this key has been cancelled |
333 * If this key has been cancelled |
334 */ |
334 */ |
335 public final boolean isConnectable() { |
335 public final boolean isConnectable() { |
341 * connection. |
341 * connection. |
342 * |
342 * |
343 * <p> An invocation of this method of the form <tt>k.isAcceptable()</tt> |
343 * <p> An invocation of this method of the form <tt>k.isAcceptable()</tt> |
344 * behaves in exactly the same way as the expression |
344 * behaves in exactly the same way as the expression |
345 * |
345 * |
346 * <blockquote><pre> |
346 * <blockquote><pre>{@code |
347 * k.readyOps() & OP_ACCEPT != 0</pre></blockquote> |
347 * k.readyOps() & OP_ACCEPT != 0 |
|
348 * }</pre></blockquote> |
348 * |
349 * |
349 * <p> If this key's channel does not support socket-accept operations then |
350 * <p> If this key's channel does not support socket-accept operations then |
350 * this method always returns <tt>false</tt>. </p> |
351 * this method always returns <tt>false</tt>. </p> |
351 * |
352 * |
352 * @return <tt>true</tt> if, and only if, |
353 * @return <tt>true</tt> if, and only if, |
353 * <tt>readyOps()</tt> <tt>&</tt> <tt>OP_ACCEPT</tt> |
354 * {@code readyOps() & OP_ACCEPT} is nonzero |
354 * is nonzero |
|
355 * |
355 * |
356 * @throws CancelledKeyException |
356 * @throws CancelledKeyException |
357 * If this key has been cancelled |
357 * If this key has been cancelled |
358 */ |
358 */ |
359 public final boolean isAcceptable() { |
359 public final boolean isAcceptable() { |