gcj nio buffer
public java v1 · immutable /* client is a SocketChannel * buf is a ByteBuffer(512) * str is a StringBuffer(100) */ try { while((rd = client.read(buf)) > 0) { log.debug("Read " + rd + " bytes"); buf.flip(); str.append(dec.decode(buf).toString()); buf.flip(); } } catch(IOException e) { log.error("Error reading from client " + client.socket().getInetAddress().getHostAddress() + ":" + client.socket().getPort(), e); key.interestOps(key.interestOps() | SelectionKey.OP_READ); return; }