Package io.undertow.conduits
Class ChunkedStreamSinkConduit
- java.lang.Object
-
- org.xnio.conduits.AbstractConduit<D>
-
- org.xnio.conduits.AbstractSinkConduit<D>
-
- org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
-
- io.undertow.conduits.ChunkedStreamSinkConduit
-
- All Implemented Interfaces:
org.xnio.conduits.Conduit
,org.xnio.conduits.SinkConduit
,org.xnio.conduits.StreamSinkConduit
public class ChunkedStreamSinkConduit extends org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
Channel that implements HTTP chunked transfer coding.- Author:
- Stuart Douglas
-
-
Field Summary
Fields Modifier and Type Field Description static AttachmentKey<HeaderMap>
TRAILERS
Deprecated.
-
Constructor Summary
Constructors Constructor Description ChunkedStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next, ByteBufferPool bufferPool, boolean configurable, boolean passClose, HeaderMap responseHeaders, ConduitListener<? super ChunkedStreamSinkConduit> finishListener, Attachable attachable)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awaitWritable()
void
awaitWritable(long time, TimeUnit timeUnit)
boolean
flush()
void
terminateWrites()
long
transferFrom(FileChannel src, long position, long count)
long
transferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer)
void
truncateWrites()
int
write(ByteBuffer src)
long
write(ByteBuffer[] srcs, int offset, int length)
int
writeFinal(ByteBuffer src)
long
writeFinal(ByteBuffer[] srcs, int offset, int length)
-
Methods inherited from class org.xnio.conduits.AbstractSinkConduit
getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
-
-
-
-
Field Detail
-
TRAILERS
@Deprecated public static final AttachmentKey<HeaderMap> TRAILERS
Deprecated.Trailers that are to be attached to the end of the HTTP response. Note that it is the callers responsibility to make sure the client understands trailers (i.e. they have provided a TE header), and to set the 'Trailers:' header appropriately.This attachment must be set before the
terminateWrites()
method is called.
-
-
Constructor Detail
-
ChunkedStreamSinkConduit
public ChunkedStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next, ByteBufferPool bufferPool, boolean configurable, boolean passClose, HeaderMap responseHeaders, ConduitListener<? super ChunkedStreamSinkConduit> finishListener, Attachable attachable)
Construct a new instance.- Parameters:
next
- the channel to wrapconfigurable
-true
to allow configuration of the next channel,false
otherwisepassClose
-true
to close the underlying channel when this channel is closed,false
otherwiseresponseHeaders
- The response headersfinishListener
- The finish listenerattachable
- The attachable
-
-
Method Detail
-
write
public int write(ByteBuffer src) throws IOException
- Specified by:
write
in interfaceorg.xnio.conduits.StreamSinkConduit
- Overrides:
write
in classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
truncateWrites
public void truncateWrites() throws IOException
- Specified by:
truncateWrites
in interfaceorg.xnio.conduits.SinkConduit
- Overrides:
truncateWrites
in classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
write
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
- Specified by:
write
in interfaceorg.xnio.conduits.StreamSinkConduit
- Overrides:
write
in classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
writeFinal
public long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException
- Specified by:
writeFinal
in interfaceorg.xnio.conduits.StreamSinkConduit
- Overrides:
writeFinal
in classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
writeFinal
public int writeFinal(ByteBuffer src) throws IOException
- Specified by:
writeFinal
in interfaceorg.xnio.conduits.StreamSinkConduit
- Overrides:
writeFinal
in classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
transferFrom
public long transferFrom(FileChannel src, long position, long count) throws IOException
- Specified by:
transferFrom
in interfaceorg.xnio.conduits.StreamSinkConduit
- Overrides:
transferFrom
in classorg.xnio.conduits.AbstractStreamSinkConduit<org.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
- Overrides:
transferFrom
in classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
flush
public boolean flush() throws IOException
- Specified by:
flush
in interfaceorg.xnio.conduits.SinkConduit
- Overrides:
flush
in classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
terminateWrites
public void terminateWrites() throws IOException
- Specified by:
terminateWrites
in interfaceorg.xnio.conduits.SinkConduit
- Overrides:
terminateWrites
in classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
awaitWritable
public void awaitWritable() throws IOException
- Specified by:
awaitWritable
in interfaceorg.xnio.conduits.SinkConduit
- Overrides:
awaitWritable
in classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
awaitWritable
public void awaitWritable(long time, TimeUnit timeUnit) throws IOException
- Specified by:
awaitWritable
in interfaceorg.xnio.conduits.SinkConduit
- Overrides:
awaitWritable
in classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
- Throws:
IOException
-
-