Package io.undertow.conduits
Class AbstractFixedLengthStreamSinkConduit
- java.lang.Object
-
- org.xnio.conduits.AbstractConduit<D>
-
- org.xnio.conduits.AbstractSinkConduit<D>
-
- org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
-
- io.undertow.conduits.AbstractFixedLengthStreamSinkConduit
-
- All Implemented Interfaces:
org.xnio.conduits.Conduit,org.xnio.conduits.SinkConduit,org.xnio.conduits.StreamSinkConduit
- Direct Known Subclasses:
ServerFixedLengthStreamSinkConduit
public abstract class AbstractFixedLengthStreamSinkConduit extends org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>A channel which writes a fixed amount of data. A listener is called once the data has been written.- Author:
- David M. Lloyd
-
-
Constructor Summary
Constructors Constructor Description AbstractFixedLengthStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next, long contentLength, boolean configurable, boolean propagateClose)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitWritable()voidawaitWritable(long time, java.util.concurrent.TimeUnit timeUnit)protected voidchannelFinished()booleanflush()longgetRemaining()Get the number of remaining bytes in this fixed length channel.booleanisWriteResumed()protected voidreset(long contentLength, boolean propagateClose)voidterminateWrites()longtransferFrom(java.nio.channels.FileChannel src, long position, long count)longtransferFrom(org.xnio.channels.StreamSourceChannel source, long count, java.nio.ByteBuffer throughBuffer)voidtruncateWrites()voidwakeupWrites()intwrite(java.nio.ByteBuffer src)longwrite(java.nio.ByteBuffer[] srcs, int offset, int length)intwriteFinal(java.nio.ByteBuffer src)longwriteFinal(java.nio.ByteBuffer[] srcs, int offset, int length)-
Methods inherited from class org.xnio.conduits.AbstractSinkConduit
getWriteThread, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites
-
-
-
-
Constructor Detail
-
AbstractFixedLengthStreamSinkConduit
public AbstractFixedLengthStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next, long contentLength, boolean configurable, boolean propagateClose)Construct a new instance.- Parameters:
next- the next channelcontentLength- the content lengthconfigurable-trueif this instance should pass configuration to the nextpropagateClose-trueif this instance should pass close to the next
-
-
Method Detail
-
reset
protected void reset(long contentLength, boolean propagateClose)
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
writein interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writein classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
write
public long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException- Specified by:
writein interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writein classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
writeFinal
public long writeFinal(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException- Specified by:
writeFinalin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writeFinalin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
writeFinal
public int writeFinal(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
writeFinalin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writeFinalin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
transferFrom
public long transferFrom(java.nio.channels.FileChannel src, long position, long count) throws java.io.IOException- Specified by:
transferFromin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
transferFromin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
transferFrom
public long transferFrom(org.xnio.channels.StreamSourceChannel source, long count, java.nio.ByteBuffer throughBuffer) throws java.io.IOException- Specified by:
transferFromin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
transferFromin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
flush
public boolean flush() throws java.io.IOException- Specified by:
flushin interfaceorg.xnio.conduits.SinkConduit- Overrides:
flushin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
isWriteResumed
public boolean isWriteResumed()
- Specified by:
isWriteResumedin interfaceorg.xnio.conduits.SinkConduit- Overrides:
isWriteResumedin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
-
wakeupWrites
public void wakeupWrites()
- Specified by:
wakeupWritesin interfaceorg.xnio.conduits.SinkConduit- Overrides:
wakeupWritesin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>
-
terminateWrites
public void terminateWrites() throws java.io.IOException- Specified by:
terminateWritesin interfaceorg.xnio.conduits.SinkConduit- Overrides:
terminateWritesin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
truncateWrites
public void truncateWrites() throws java.io.IOException- Specified by:
truncateWritesin interfaceorg.xnio.conduits.SinkConduit- Overrides:
truncateWritesin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
awaitWritable
public void awaitWritable() throws java.io.IOException- Specified by:
awaitWritablein interfaceorg.xnio.conduits.SinkConduit- Overrides:
awaitWritablein classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
awaitWritable
public void awaitWritable(long time, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOException- Specified by:
awaitWritablein interfaceorg.xnio.conduits.SinkConduit- Overrides:
awaitWritablein classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
java.io.IOException
-
getRemaining
public long getRemaining()
Get the number of remaining bytes in this fixed length channel.- Returns:
- the number of remaining bytes
-
channelFinished
protected void channelFinished()
-
-