private void invokeFinishListener() { state |= FLAG_FINISHED; if (finishListener != null) { finishListener.handleEvent(this); } }
protected ChunkedStreamSourceConduit(final StreamSourceConduit next, final BufferWrapper bufferWrapper, final ConduitListener<? super ChunkedStreamSourceConduit> finishListener, final Attachable attachable, final HttpServerExchange exchange, final Closeable closeable) { super(next); this.bufferWrapper = bufferWrapper; this.finishListener = finishListener; this.remainingAllowed = Long.MIN_VALUE; this.chunkReader = new ChunkReader<>(attachable, HttpAttachments.REQUEST_TRAILERS, this); this.exchange = exchange; this.closeable = closeable; }
@Override public void failed(IOException e) { done(); } }
public DeflateEncodingProvider(int deflateLevel) { this(DeflatingStreamSinkConduit.newInstanceDeflaterPool(deflateLevel)); }
public GzipStreamSinkConduit( ConduitFactory<StreamSinkConduit> conduitFactory, HttpServerExchange exchange, int deflateLevel) { this(conduitFactory, exchange, newInstanceDeflaterPool(deflateLevel)); }
@Override public int write(final ByteBuffer src) throws IOException { return doWrite(src); }
@Override public int write(final ByteBuffer src) throws IOException { return doWrite(src); }
public void wakeupReads() { resumeReads(); }
public boolean isFinished() { return closed || chunkReader.getChunkRemaining() == -1; }
public void setIdleTimeout(long timeout) { idleTimeoutConduit.setIdleTimeout(timeout); }
public long getIdleTimeout() { return idleTimeoutConduit.getIdleTimeout(); }
public long read(final ByteBuffer[] dsts) throws IOException { return read(dsts, 0, dsts.length); }
protected IdleTimeoutConduit createIdleTimeoutChannel(StreamConnection connectedStreamChannel) { return new IdleTimeoutConduit(connectedStreamChannel); }
private void invokeFinishListener() { state |= FLAG_FINISHED; if (finishListener != null) { finishListener.handleEvent(this); } }
/** * Construct a new instance. * * @param next the channel to wrap * @param finishListener The finish listener * @param attachable The attachable */ public PreChunkedStreamSinkConduit(final StreamSinkConduit next, final ConduitListener<? super PreChunkedStreamSinkConduit> finishListener, final Attachable attachable) { super(next); //we don't want the reader to call the finish listener, so we pass null this.chunkReader = new ChunkReader<>(attachable, HttpAttachments.RESPONSE_TRAILERS, this); this.finishListener = finishListener; }
public DeflatingStreamSinkConduit(final ConduitFactory<StreamSinkConduit> conduitFactory, final HttpServerExchange exchange, int deflateLevel) { this(conduitFactory, exchange, newInstanceDeflaterPool(deflateLevel)); }
@Override protected void finished() { if (finishListener != null) { finishListener.handleEvent(this); } }
private void invokeFinishListener() { this.state |= FLAG_FINISHED; finishListener.handleEvent(this); }
/** * Exit a read method. * * @param consumed the number of bytes consumed by this call (may be 0) */ private void exitRead(long consumed) { if (consumed == -1) { if (!finishCalled) { finishCalled = true; finishListener.handleEvent(this); } } } }