Package io.undertow.conduits
Class DeflatingStreamSinkConduit
java.lang.Object
io.undertow.conduits.DeflatingStreamSinkConduit
- All Implemented Interfaces:
org.xnio.conduits.Conduit,org.xnio.conduits.SinkConduit,org.xnio.conduits.StreamSinkConduit
- Direct Known Subclasses:
GzipStreamSinkConduit
public class DeflatingStreamSinkConduit
extends Object
implements org.xnio.conduits.StreamSinkConduit
Channel that handles deflate compression
- Author:
- Stuart Douglas
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PooledByteBufferThe streams buffer.protected Deflaterprotected final PooledObject<Deflater> -
Constructor Summary
ConstructorsConstructorDescriptionDeflatingStreamSinkConduit(ConduitFactory<org.xnio.conduits.StreamSinkConduit> conduitFactory, HttpServerExchange exchange) DeflatingStreamSinkConduit(ConduitFactory<org.xnio.conduits.StreamSinkConduit> conduitFactory, HttpServerExchange exchange, int deflateLevel) DeflatingStreamSinkConduit(ConduitFactory<org.xnio.conduits.StreamSinkConduit> conduitFactory, HttpServerExchange exchange, ObjectPool<Deflater> deflaterPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidawaitWritable(long time, TimeUnit timeUnit) booleanflush()protected byte[]called before the stream is finally flushed.org.xnio.XnioWorkerorg.xnio.XnioIoThreadbooleanbooleanstatic ObjectPool<Deflater>newInstanceDeflaterPool(int deflateLevel) protected voidpreDeflate(byte[] data) voidvoidsetWriteReadyHandler(org.xnio.conduits.WriteReadyHandler handler) static ObjectPool<Deflater>simpleDeflaterPool(int poolSize, int deflateLevel) voidvoidlongtransferFrom(FileChannel src, long position, long count) longtransferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) voidvoidintwrite(ByteBuffer src) longwrite(ByteBuffer[] srcs, int offset, int length) intwriteFinal(ByteBuffer src) longwriteFinal(ByteBuffer[] srcs, int offset, int length)
-
Field Details
-
deflater
-
pooledObject
-
currentBuffer
The streams buffer. This is freed when the next is shutdown
-
-
Constructor Details
-
DeflatingStreamSinkConduit
public DeflatingStreamSinkConduit(ConduitFactory<org.xnio.conduits.StreamSinkConduit> conduitFactory, HttpServerExchange exchange) -
DeflatingStreamSinkConduit
public DeflatingStreamSinkConduit(ConduitFactory<org.xnio.conduits.StreamSinkConduit> conduitFactory, HttpServerExchange exchange, int deflateLevel) -
DeflatingStreamSinkConduit
public DeflatingStreamSinkConduit(ConduitFactory<org.xnio.conduits.StreamSinkConduit> conduitFactory, HttpServerExchange exchange, ObjectPool<Deflater> deflaterPool)
-
-
Method Details
-
newInstanceDeflaterPool
-
simpleDeflaterPool
-
write
- Specified by:
writein interfaceorg.xnio.conduits.StreamSinkConduit- Throws:
IOException
-
preDeflate
protected void preDeflate(byte[] data) -
write
- Specified by:
writein interfaceorg.xnio.conduits.StreamSinkConduit- Throws:
IOException
-
writeFinal
- Specified by:
writeFinalin interfaceorg.xnio.conduits.StreamSinkConduit- Throws:
IOException
-
writeFinal
- Specified by:
writeFinalin interfaceorg.xnio.conduits.StreamSinkConduit- Throws:
IOException
-
transferFrom
- Specified by:
transferFromin interfaceorg.xnio.conduits.StreamSinkConduit- Throws:
IOException
-
transferFrom
public long transferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException - Specified by:
transferFromin interfaceorg.xnio.conduits.StreamSinkConduit- Throws:
IOException
-
getWorker
public org.xnio.XnioWorker getWorker()- Specified by:
getWorkerin interfaceorg.xnio.conduits.Conduit
-
suspendWrites
public void suspendWrites()- Specified by:
suspendWritesin interfaceorg.xnio.conduits.SinkConduit
-
isWriteResumed
public boolean isWriteResumed()- Specified by:
isWriteResumedin interfaceorg.xnio.conduits.SinkConduit
-
wakeupWrites
public void wakeupWrites()- Specified by:
wakeupWritesin interfaceorg.xnio.conduits.SinkConduit
-
resumeWrites
public void resumeWrites()- Specified by:
resumeWritesin interfaceorg.xnio.conduits.SinkConduit
-
terminateWrites
- Specified by:
terminateWritesin interfaceorg.xnio.conduits.SinkConduit- Throws:
IOException
-
isWriteShutdown
public boolean isWriteShutdown()- Specified by:
isWriteShutdownin interfaceorg.xnio.conduits.SinkConduit
-
awaitWritable
- Specified by:
awaitWritablein interfaceorg.xnio.conduits.SinkConduit- Throws:
IOException
-
awaitWritable
- Specified by:
awaitWritablein interfaceorg.xnio.conduits.SinkConduit- Throws:
IOException
-
getWriteThread
public org.xnio.XnioIoThread getWriteThread()- Specified by:
getWriteThreadin interfaceorg.xnio.conduits.SinkConduit
-
setWriteReadyHandler
public void setWriteReadyHandler(org.xnio.conduits.WriteReadyHandler handler) - Specified by:
setWriteReadyHandlerin interfaceorg.xnio.conduits.SinkConduit
-
flush
- Specified by:
flushin interfaceorg.xnio.conduits.SinkConduit- Throws:
IOException
-
getTrailer
protected byte[] getTrailer()called before the stream is finally flushed. -
truncateWrites
- Specified by:
truncateWritesin interfaceorg.xnio.conduits.SinkConduit- Throws:
IOException
-