Package io.undertow.conduits
Class AbstractFramedStreamSinkConduit
java.lang.Object
org.xnio.conduits.AbstractConduit<D>
org.xnio.conduits.AbstractSinkConduit<D>
org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
io.undertow.conduits.AbstractFramedStreamSinkConduit
- All Implemented Interfaces:
org.xnio.conduits.Conduit,org.xnio.conduits.SinkConduit,org.xnio.conduits.StreamSinkConduit
public class AbstractFramedStreamSinkConduit
extends org.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>
Utility class to ease the implementation of framed protocols. This call provides a queue of frames, and a callback
that can be invoked when a frame event occurs.
When a write takes place all frames are attempted to be written out at once via a gathering write. Frames can be
queued via queueFrame(io.undertow.conduits.AbstractFramedStreamSinkConduit.FrameCallBack, java.nio.ByteBuffer...).
- Author:
- Stuart Douglas
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface that is called when a frame event takes place.protected static classprotected static class -
Field Summary
Fields inherited from class org.xnio.conduits.AbstractConduit
next -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFramedStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidfinished()protected booleanprotected booleanprotected voidprotected longprotected voidqueueFrame(AbstractFramedStreamSinkConduit.FrameCallBack callback, ByteBuffer... data) Queues a frame for sending.voidlongtransferFrom(FileChannel src, long position, long count) longtransferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) voidintwrite(ByteBuffer src) longwrite(ByteBuffer[] srcs, int offs, int len) intwriteFinal(ByteBuffer src) longwriteFinal(ByteBuffer[] srcs, int offs, int len) Methods inherited from class org.xnio.conduits.AbstractSinkConduit
awaitWritable, awaitWritable, flush, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWritesMethods inherited from class org.xnio.conduits.AbstractConduit
getWorkerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xnio.conduits.Conduit
getWorkerMethods inherited from interface org.xnio.conduits.SinkConduit
awaitWritable, awaitWritable, flush, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
-
Constructor Details
-
AbstractFramedStreamSinkConduit
protected AbstractFramedStreamSinkConduit(org.xnio.conduits.StreamSinkConduit next) Construct a new instance.- Parameters:
next- the delegate conduit to set
-
-
Method Details
-
queueFrame
protected void queueFrame(AbstractFramedStreamSinkConduit.FrameCallBack callback, ByteBuffer... data) Queues a frame for sending.- Parameters:
callback-data-
-
transferFrom
- Specified by:
transferFromin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
transferFromin 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:
transferFromin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
transferFromin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
write
- Specified by:
writein interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writein classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
write
- Specified by:
writein interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writein classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
writeFinal
- Specified by:
writeFinalin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writeFinalin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
writeFinal
- Specified by:
writeFinalin interfaceorg.xnio.conduits.StreamSinkConduit- Overrides:
writeFinalin classorg.xnio.conduits.AbstractStreamSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
queuedDataLength
protected long queuedDataLength() -
terminateWrites
- Specified by:
terminateWritesin interfaceorg.xnio.conduits.SinkConduit- Overrides:
terminateWritesin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
doTerminateWrites
- Throws:
IOException
-
flushQueuedData
- Throws:
IOException
-
truncateWrites
- Specified by:
truncateWritesin interfaceorg.xnio.conduits.SinkConduit- Overrides:
truncateWritesin classorg.xnio.conduits.AbstractSinkConduit<org.xnio.conduits.StreamSinkConduit>- Throws:
IOException
-
isWritesTerminated
protected boolean isWritesTerminated() -
queueCloseFrames
protected void queueCloseFrames() -
finished
protected void finished()
-