Code example for SelectableChannel

Methods: configureBlocking, register

			SelectableChannel channel, int ops) throws Exception {
		if (channel == null) {
			return; // could happen 
		// Set the new channel nonblocking 
		// Register it with the selector 
		channel.register(selector, ops);
	// ---------------------------------------------------------- 
	// Use the same byte buffer for all channels. A single thread is 
	// servicing all the channels, so no danger of concurrent acccess. 
	private ByteBuffer buffer = ByteBuffer.allocateDirect(1024);
	 * Sample data handler method for a channel with data ready to read. 
	 * @param key 
	 *            A SelectionKey object associated with a channel determined by 
	 *            the selector to be ready for reading. If the channel returns