Package io.undertow.conduits
Class InflatingStreamSourceConduit
- java.lang.Object
-
- org.xnio.conduits.AbstractConduit<D>
-
- org.xnio.conduits.AbstractSourceConduit<D>
-
- org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>
-
- io.undertow.conduits.InflatingStreamSourceConduit
-
- All Implemented Interfaces:
org.xnio.conduits.Conduit,org.xnio.conduits.SourceConduit,org.xnio.conduits.StreamSourceConduit
- Direct Known Subclasses:
GzipStreamSourceConduit
public class InflatingStreamSourceConduit extends org.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>- Author:
- Stuart Douglas
-
-
Field Summary
Fields Modifier and Type Field Description static ConduitWrapper<org.xnio.conduits.StreamSourceConduit>WRAPPER
-
Constructor Summary
Constructors Constructor Description InflatingStreamSourceConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSourceConduit next)InflatingStreamSourceConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSourceConduit next, ObjectPool<Inflater> inflaterPool)InflatingStreamSourceConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSourceConduit next, ObjectPool<Inflater> inflaterPool, ObjectPool<Inflater> inflaterWrappingPool)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddataDeflated(byte[] data, int off, int len)protected voidinitializeInflater(ByteBuffer buf)protected booleanisZlibHeaderPresent(ByteBuffer buf)static ObjectPool<Inflater>newInstanceInflaterPool()Create non-wrapping(gzip/zlib without headers) inflater poolstatic ObjectPool<Inflater>newInstanceWrappingInflaterPool()Create wrapping inflater pool, one that expects headers.intread(ByteBuffer dst)longread(ByteBuffer[] dsts, int offset, int length)protected voidreadFooter(ByteBuffer buf)protected booleanreadHeader(ByteBuffer byteBuffer)static ObjectPool<Inflater>simpleInflaterPool(int poolSize)Create non-wrapping(gzip/zlib without headers) inflater poolstatic ObjectPool<Inflater>simpleWrappingInflaterPool(int poolSize)Create wrapping inflater pool, one that expects headers.voidterminateReads()longtransferTo(long position, long count, FileChannel target)longtransferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target)-
Methods inherited from class org.xnio.conduits.AbstractSourceConduit
awaitReadable, awaitReadable, getReadThread, isReadResumed, isReadShutdown, resumeReads, setReadReadyHandler, suspendReads, wakeupReads
-
-
-
-
Field Detail
-
WRAPPER
public static final ConduitWrapper<org.xnio.conduits.StreamSourceConduit> WRAPPER
-
-
Constructor Detail
-
InflatingStreamSourceConduit
public InflatingStreamSourceConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSourceConduit next)
-
InflatingStreamSourceConduit
public InflatingStreamSourceConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSourceConduit next, ObjectPool<Inflater> inflaterPool)
-
InflatingStreamSourceConduit
public InflatingStreamSourceConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSourceConduit next, ObjectPool<Inflater> inflaterPool, ObjectPool<Inflater> inflaterWrappingPool)
-
-
Method Detail
-
newInstanceInflaterPool
public static ObjectPool<Inflater> newInstanceInflaterPool()
Create non-wrapping(gzip/zlib without headers) inflater pool- Returns:
-
simpleInflaterPool
public static ObjectPool<Inflater> simpleInflaterPool(int poolSize)
Create non-wrapping(gzip/zlib without headers) inflater pool- Returns:
-
newInstanceWrappingInflaterPool
public static ObjectPool<Inflater> newInstanceWrappingInflaterPool()
Create wrapping inflater pool, one that expects headers.- Returns:
-
simpleWrappingInflaterPool
public static ObjectPool<Inflater> simpleWrappingInflaterPool(int poolSize)
Create wrapping inflater pool, one that expects headers.- Returns:
-
read
public int read(ByteBuffer dst) throws IOException
- Specified by:
readin interfaceorg.xnio.conduits.StreamSourceConduit- Overrides:
readin classorg.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>- Throws:
IOException
-
initializeInflater
protected void initializeInflater(ByteBuffer buf) throws IOException
- Throws:
IOException
-
isZlibHeaderPresent
protected boolean isZlibHeaderPresent(ByteBuffer buf) throws IOException
- Throws:
IOException
-
readFooter
protected void readFooter(ByteBuffer buf) throws IOException
- Throws:
IOException
-
readHeader
protected boolean readHeader(ByteBuffer byteBuffer) throws IOException
- Throws:
IOException
-
dataDeflated
protected void dataDeflated(byte[] data, int off, int len)
-
transferTo
public long transferTo(long position, long count, FileChannel target) throws IOException- Specified by:
transferToin interfaceorg.xnio.conduits.StreamSourceConduit- Overrides:
transferToin classorg.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>- Throws:
IOException
-
transferTo
public long transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target) throws IOException- Specified by:
transferToin interfaceorg.xnio.conduits.StreamSourceConduit- Overrides:
transferToin classorg.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>- Throws:
IOException
-
read
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
- Specified by:
readin interfaceorg.xnio.conduits.StreamSourceConduit- Overrides:
readin classorg.xnio.conduits.AbstractStreamSourceConduit<org.xnio.conduits.StreamSourceConduit>- Throws:
IOException
-
terminateReads
public void terminateReads() throws IOException- Specified by:
terminateReadsin interfaceorg.xnio.conduits.SourceConduit- Overrides:
terminateReadsin classorg.xnio.conduits.AbstractSourceConduit<org.xnio.conduits.StreamSourceConduit>- Throws:
IOException
-
-