private static boolean hasNextByte(ByteBuffer buffer) { return BufferUtil.hasContent(buffer); }
@Override public ByteBuffer onUpgradeFrom() { if (BufferUtil.hasContent(_requestBuffer)) { ByteBuffer buffer = _requestBuffer; _requestBuffer=null; return buffer; } return null; }
@Override public ByteBuffer onUpgradeFrom() { if (BufferUtil.hasContent(_requestBuffer)) { ByteBuffer buffer = _requestBuffer; _requestBuffer=null; return buffer; } return null; }
@Override protected boolean needsFill() throws IOException { if (_closed) throw new ClosedChannelException(); return _in == null || BufferUtil.hasContent(_in); }
@Override protected boolean needsFill() throws IOException { if (_closed) throw new ClosedChannelException(); return _in == null || BufferUtil.hasContent(_in); }
protected ByteBuffer onUpgradeFrom() { if (BufferUtil.hasContent(buffer)) { ByteBuffer upgradeBuffer = ByteBuffer.allocate(buffer.remaining()); upgradeBuffer.put(buffer).flip(); return upgradeBuffer; } return null; }
private void releaseBuffers(ByteBufferPool bufferPool, ByteBuffer header, ByteBuffer chunk) { if (!BufferUtil.hasContent(header)) bufferPool.release(header); if (!BufferUtil.hasContent(chunk)) bufferPool.release(chunk); }
public void resetBuffer() { if (BufferUtil.hasContent(_aggregate)) BufferUtil.clear(_aggregate); } }
private void releaseBuffers(ByteBufferPool bufferPool, ByteBuffer header, ByteBuffer chunk) { if (!BufferUtil.hasContent(header)) bufferPool.release(header); if (!BufferUtil.hasContent(chunk)) bufferPool.release(chunk); }
public void resetBuffer() { if (BufferUtil.hasContent(_aggregate)) BufferUtil.clear(_aggregate); }
public void resetBuffer() { if (BufferUtil.hasContent(_aggregate)) BufferUtil.clear(_aggregate); } }
@Override protected void needsFillInterest() throws IOException { try(Locker.Lock lock = _locker.lock()) { if (_closed) throw new ClosedChannelException(); ByteBuffer in = _inQ.peek(); if (BufferUtil.hasContent(in) || in==EOF) execute(_runFillable); } }
public void resetBuffer() { _written = 0; if (BufferUtil.hasContent(_aggregate)) BufferUtil.clear(_aggregate); reopen(); }
private void releaseBuffer() { if (buffer == null) throw new IllegalStateException(); if (BufferUtil.hasContent(buffer)) throw new IllegalStateException(); HttpClient client = getHttpDestination().getHttpClient(); ByteBufferPool bufferPool = client.getByteBufferPool(); bufferPool.release(buffer); buffer = null; }
@Override protected void needsFillInterest() throws IOException { try(Locker.Lock lock = _locker.lock()) { if (!isOpen()) throw new ClosedChannelException(); ByteBuffer in = _inQ.peek(); if (BufferUtil.hasContent(in) || isEOF(in)) execute(_runFillable); } }
@Override protected void needsFillInterest() throws IOException { try(Locker.Lock lock = _locker.lock()) { if (!isOpen()) throw new ClosedChannelException(); ByteBuffer in = _inQ.peek(); if (BufferUtil.hasContent(in) || isEOF(in)) execute(_runFillable); } }
@Override public void flush() throws IOException { if (isClosed()) return; if (BufferUtil.hasContent(_aggregate)) _channel.write(_aggregate, false); else _channel.write(BufferUtil.EMPTY_BUFFER, false); }
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, ByteBuffer input, ByteBuffer output) { super(timer,NOIP,NOIP); if (BufferUtil.hasContent(input)) addInput(input); _out=output==null?BufferUtil.allocate(1024):output; setIdleTimeout(idleTimeoutMs); }
public void addInput(String s) { // TODO this is a busy wait while(getIn()==null || BufferUtil.hasContent(getIn())) Thread.yield(); setInput(BufferUtil.toBuffer(s, StandardCharsets.UTF_8)); }
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, ByteBuffer input, ByteBuffer output) { super(timer); if (BufferUtil.hasContent(input)) addInput(input); _out=output==null?BufferUtil.allocate(1024):output; setIdleTimeout(idleTimeoutMs); onOpen(); }