Code example for SocketChannel

Methods: write

0
			return true; 
		} 
	} 
 
	private void _write(byte[] bytes) throws IOException {
		this.socketChannel.write(ByteBuffer.wrap(bytes));
	} 
 
	private void _read() throws IOException, NoSuchAlgorithmException { 
		this.buffer.rewind();
 
		int bytesRead = -1;
		try { 
			bytesRead = this.socketChannel.read(this.buffer);
		} catch (Exception ex) {
		} 
 
		if (bytesRead == -1) {
			close(); 
		} else if (bytesRead > 0) {
			this.buffer.rewind();