Top Fields Constructors Methods
io.undertow.conduits

public Class InflatingStreamSourceConduit

extends AbstractStreamSourceConduit<StreamSourceConduit>
Class Inheritance
Known Direct Subclasses
io.undertow.conduits.GzipStreamSourceConduit
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.ClosedChannelException, .FileChannel, java.util.zip.DataFormatException, .Inflater, org.xnio.Buffers, .IoUtils, org.xnio.channels.StreamSinkChannel, org.xnio.conduits.AbstractStreamSourceConduit, .ConduitReadableByteChannel, .StreamSourceConduit, io.undertow.UndertowLogger, io.undertow.connector.PooledByteBuffer, io.undertow.server.ConduitWrapper, .HttpServerExchange, io.undertow.util.ConduitFactory, .NewInstanceObjectPool, .ObjectPool, .PooledObject, .SimpleObjectPool

Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private PooledByteBuffer
private final HttpServerExchange
private boolean
private volatile Inflater
private boolean
private final PooledObject<Inflater>
private PooledByteBuffer
public static final ConduitWrapper<StreamSourceConduit>

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected void
dataDeflated(byte[] data, int off, int len)

private void
done()

public static ObjectPool<Inflater>
public int
read(ByteBuffer
the buffer to fill with data from the conduit
dst
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffer.

public long
read(final ByteBuffer[]
the buffers to fill with data from the conduit
dsts
,
final int
the offset into the buffer array
offset
,
final int
the number of buffers to fill
length
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffers.

protected void
protected boolean
readHeader(ByteBuffer byteBuffer)

public static ObjectPool<Inflater>
simpleInflaterPool(int poolSize)

public void
terminateReads()

Overrides org.xnio.conduits.AbstractSourceConduit.terminateReads.

Implements org.xnio.conduits.SourceConduit.terminateReads.

Indicate that no more data will be read from this conduit.

public long
transferTo(final long
the position within the file from which the transfer is to begin
position
,
final long
the number of bytes to be transferred
count
,
final FileChannel
the file to write to
target
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given file from this channel.

public long
transferTo(final long
the number of bytes to be transferred
count
,
final ByteBuffer
the buffer to copy through.
throughBuffer
,
final StreamSinkChannel
the destination to write to
target
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given channel target.

Field Detail

compressedback to summary
private PooledByteBuffer compressed
exchangeback to summary
private final HttpServerExchange exchange
headerDoneback to summary
private boolean headerDone
inflaterback to summary
private volatile Inflater inflater
nextDoneback to summary
private boolean nextDone
pooledObjectback to summary
private final PooledObject<Inflater> pooledObject
uncompressedback to summary
private PooledByteBuffer uncompressed
WRAPPERback to summary
public static final ConduitWrapper<StreamSourceConduit> WRAPPER

Constructor Detail

InflatingStreamSourceConduitback to summary
public InflatingStreamSourceConduit(HttpServerExchange exchange, StreamSourceConduit next)
InflatingStreamSourceConduitback to summary
public InflatingStreamSourceConduit(HttpServerExchange exchange, StreamSourceConduit next, ObjectPool<Inflater> inflaterPool)

Method Detail

dataDeflatedback to summary
protected void dataDeflated(byte[] data, int off, int len)
doneback to summary
private void done()
newInstanceInflaterPoolback to summary
public static ObjectPool<Inflater> newInstanceInflaterPool()
readback to summary
public int read(ByteBuffer dst) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Doc from org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffer.

Parameters
dst:ByteBuffer

the buffer to fill with data from the conduit

Returns:int

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called

Annotations
@Override
Exceptions
IOException:
if an error occurs
readback to summary
public long read(final ByteBuffer[] dsts, final int offset, final int length) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Doc from org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffers.

Parameters
dsts:ByteBuffer[]

the buffers to fill with data from the conduit

offset:int

the offset into the buffer array

length:int

the number of buffers to fill

Returns:long

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called

Annotations
@Override
Exceptions
IOException:
if an error occurs
readFooterback to summary
protected void readFooter(ByteBuffer buf) throws IOException
readHeaderback to summary
protected boolean readHeader(ByteBuffer byteBuffer) throws IOException
simpleInflaterPoolback to summary
public static ObjectPool<Inflater> simpleInflaterPool(int poolSize)
terminateReadsback to summary
public void terminateReads() throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.terminateReads.

Implements org.xnio.conduits.SourceConduit.terminateReads.

Doc from org.xnio.conduits.SourceConduit.terminateReads.

Indicate that no more data will be read from this conduit. If unread data exists, an exception may be thrown.

Annotations
@Override
Exceptions
IOException:
if there was a problem
transferToback to summary
public long transferTo(final long position, final long count, final FileChannel target) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Doc from org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given file from this channel.

Parameters
position:long

the position within the file from which the transfer is to begin

count:long

the number of bytes to be transferred

target:FileChannel

the file to write to

Returns:long

the number of bytes (possibly 0) that were actually transferred

Exceptions
IOException:
if an I/O error occurs
transferToback to summary
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Doc from org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given channel target. On entry, throughBuffer will be cleared. On exit, the buffer will be flipped for emptying, and may possibly be empty or may contain data. If this method returns a value less than count, then the remaining data in throughBuffer may contain data read from this channel which must be written to target to complete the operation.

Parameters
count:long

the number of bytes to be transferred

throughBuffer:ByteBuffer

the buffer to copy through.

target:StreamSinkChannel

the destination to write to

Returns:long

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs