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 PooledByteBuffer
The streams buffer.protected Deflater
protected 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 TypeMethodDescriptionvoid
void
awaitWritable
(long time, TimeUnit timeUnit) boolean
flush()
protected byte[]
called before the stream is finally flushed.org.xnio.XnioWorker
org.xnio.XnioIoThread
boolean
boolean
static ObjectPool<Deflater>
newInstanceDeflaterPool
(int deflateLevel) protected void
preDeflate
(byte[] data) void
void
setWriteReadyHandler
(org.xnio.conduits.WriteReadyHandler handler) static ObjectPool<Deflater>
simpleDeflaterPool
(int poolSize, int deflateLevel) void
void
long
transferFrom
(FileChannel src, long position, long count) long
transferFrom
(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) void
void
int
write
(ByteBuffer src) long
write
(ByteBuffer[] srcs, int offset, int length) int
writeFinal
(ByteBuffer src) long
writeFinal
(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:
write
in interfaceorg.xnio.conduits.StreamSinkConduit
- Throws:
IOException
-
preDeflate
protected void preDeflate(byte[] data) -
write
- Specified by:
write
in interfaceorg.xnio.conduits.StreamSinkConduit
- Throws:
IOException
-
writeFinal
- Specified by:
writeFinal
in interfaceorg.xnio.conduits.StreamSinkConduit
- Throws:
IOException
-
writeFinal
- Specified by:
writeFinal
in interfaceorg.xnio.conduits.StreamSinkConduit
- Throws:
IOException
-
transferFrom
- Specified by:
transferFrom
in interfaceorg.xnio.conduits.StreamSinkConduit
- Throws:
IOException
-
transferFrom
public long transferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException - Specified by:
transferFrom
in interfaceorg.xnio.conduits.StreamSinkConduit
- Throws:
IOException
-
getWorker
public org.xnio.XnioWorker getWorker()- Specified by:
getWorker
in interfaceorg.xnio.conduits.Conduit
-
suspendWrites
public void suspendWrites()- Specified by:
suspendWrites
in interfaceorg.xnio.conduits.SinkConduit
-
isWriteResumed
public boolean isWriteResumed()- Specified by:
isWriteResumed
in interfaceorg.xnio.conduits.SinkConduit
-
wakeupWrites
public void wakeupWrites()- Specified by:
wakeupWrites
in interfaceorg.xnio.conduits.SinkConduit
-
resumeWrites
public void resumeWrites()- Specified by:
resumeWrites
in interfaceorg.xnio.conduits.SinkConduit
-
terminateWrites
- Specified by:
terminateWrites
in interfaceorg.xnio.conduits.SinkConduit
- Throws:
IOException
-
isWriteShutdown
public boolean isWriteShutdown()- Specified by:
isWriteShutdown
in interfaceorg.xnio.conduits.SinkConduit
-
awaitWritable
- Specified by:
awaitWritable
in interfaceorg.xnio.conduits.SinkConduit
- Throws:
IOException
-
awaitWritable
- Specified by:
awaitWritable
in interfaceorg.xnio.conduits.SinkConduit
- Throws:
IOException
-
getWriteThread
public org.xnio.XnioIoThread getWriteThread()- Specified by:
getWriteThread
in interfaceorg.xnio.conduits.SinkConduit
-
setWriteReadyHandler
public void setWriteReadyHandler(org.xnio.conduits.WriteReadyHandler handler) - Specified by:
setWriteReadyHandler
in interfaceorg.xnio.conduits.SinkConduit
-
flush
- Specified by:
flush
in interfaceorg.xnio.conduits.SinkConduit
- Throws:
IOException
-
getTrailer
protected byte[] getTrailer()called before the stream is finally flushed. -
truncateWrites
- Specified by:
truncateWrites
in interfaceorg.xnio.conduits.SinkConduit
- Throws:
IOException
-