public java.nio.ByteBuffer buf() { return buf.buf(); }
/** * Writes the content of the specified <tt>src</tt> into this buffer. */ public ByteBuffer put(ByteBuffer src) { return put(src.buf()); }
CoderResult cr; if (hasRemaining()) { cr = decoder.decode(buf(), out, true); } else { cr = decoder.flush(out);
localWrittenBytes = ch.write(buf.buf()); if (localWrittenBytes != 0 || !buf.hasRemaining()) { break;
int localWrittenBytes = ch.write(buf.buf()); writtenBytes += localWrittenBytes;
CoderResult cr; if (hasRemaining()) { cr = decoder.decode(buf(), out, true); } else { cr = decoder.flush(out);
CoderResult cr; if (hasRemaining()) { cr = decoder.decode(buf(), out, true); } else { cr = decoder.flush(out);
int localWrittenBytes = ch.send(buf.buf(), destination); writtenBytes += localWrittenBytes;
private void readSession(DatagramSessionImpl session) { ByteBuffer readBuf = ByteBuffer.allocate(session.getReadBufferSize()); try { int readBytes = session.getChannel().read(readBuf.buf()); if (readBytes > 0) { readBuf.flip(); ByteBuffer newBuf = ByteBuffer.allocate(readBuf.limit()); newBuf.put(readBuf); newBuf.flip(); session.increaseReadBytes(readBytes); session.getFilterChain().fireMessageReceived(session, newBuf); } } catch (IOException e) { session.getFilterChain().fireExceptionCaught(session, e); } finally { readBuf.release(); } }
while ((ret = ch.read(buf.buf())) > 0) { readBytes += ret;
private void readSession(DatagramChannel channel, RegistrationRequest req) throws Exception { ByteBuffer readBuf = ByteBuffer .allocate(((DatagramSessionConfig) req.config .getSessionConfig()).getReceiveBufferSize()); try { SocketAddress remoteAddress = channel.receive(readBuf.buf()); if (remoteAddress != null) { DatagramSessionImpl session = (DatagramSessionImpl) newSession( remoteAddress, req.address); readBuf.flip(); ByteBuffer newBuf = ByteBuffer.allocate(readBuf.limit()); newBuf.put(readBuf); newBuf.flip(); session.increaseReadBytes(newBuf.remaining()); session.getFilterChain().fireMessageReceived(session, newBuf); } } finally { readBuf.release(); } }