Package io.undertow.websockets.core
Class StreamSourceFrameChannel
java.lang.Object
io.undertow.server.protocol.framed.AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
io.undertow.websockets.core.StreamSourceFrameChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,InterruptibleChannel,ReadableByteChannel,ScatteringByteChannel,org.xnio.channels.CloseableChannel,org.xnio.channels.Configurable,org.xnio.channels.StreamSourceChannel,org.xnio.channels.SuspendableReadChannel
public abstract class StreamSourceFrameChannel
extends AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
Base class for processes Frame bases StreamSourceChannels.
- Author:
- Norman Maurer
-
Field Summary
FieldsFields inherited from interface org.xnio.channels.Configurable
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStreamSourceFrameChannel(WebSocketChannel wsChannel, WebSocketFrameType type, int rsv, boolean finalFragment, PooledByteBuffer pooled, long frameLength, Masker masker, ChannelFunction... functions) protectedStreamSourceFrameChannel(WebSocketChannel wsChannel, WebSocketFrameType type, PooledByteBuffer pooled, long frameLength) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterRead(ByteBuffer buffer, int position, int length) Called after data was read into theByteBufferprotected voidchecker(ByteBuffer buffer, int position, int length, boolean complete) voidprotected WebSocketChannelintgetRsv()Return the rsv which is used for extensions.getType()Return theWebSocketFrameTypeornullif its not known at the calling time.protected voidhandleHeaderData(FrameHeaderData headerData) booleanFlag to indicate if this frame is the final fragment in a message.protected PooledByteBufferprocessFrameData(PooledByteBuffer frameData, boolean lastFragmentOfFrame) intread(ByteBuffer dst) final longread(ByteBuffer[] dsts) longread(ByteBuffer[] dsts, int offset, int length) final longtransferTo(long position, long count, FileChannel target) final longtransferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target) Methods inherited from class io.undertow.server.protocol.framed.AbstractFramedStreamSourceChannel
addCloseTask, awaitReadable, awaitReadable, channelForciblyClosed, close, complete, dataReady, getCloseSetter, getIoThread, getMaxStreamSize, getOption, getReadFrameCount, getReadSetter, getReadThread, getWorker, isComplete, isLastFrame, isOpen, isReadResumed, lastFrame, markStreamBroken, resumeReads, setMaxStreamSize, setOption, shutdownReads, supportsOption, suspendReads, updateFrameDataRemaining, wakeupReads
-
Field Details
-
type
-
-
Constructor Details
-
StreamSourceFrameChannel
protected StreamSourceFrameChannel(WebSocketChannel wsChannel, WebSocketFrameType type, PooledByteBuffer pooled, long frameLength) -
StreamSourceFrameChannel
protected StreamSourceFrameChannel(WebSocketChannel wsChannel, WebSocketFrameType type, int rsv, boolean finalFragment, PooledByteBuffer pooled, long frameLength, Masker masker, ChannelFunction... functions)
-
-
Method Details
-
getType
Return theWebSocketFrameTypeornullif its not known at the calling time. -
isFinalFragment
public boolean isFinalFragment()Flag to indicate if this frame is the final fragment in a message. The first fragment (frame) may also be the final fragment. -
getRsv
public int getRsv()Return the rsv which is used for extensions. -
getFramedChannel
-
getWebSocketChannel
-
finalFrame
public void finalFrame() -
handleHeaderData
-
transferTo
- Specified by:
transferToin interfaceorg.xnio.channels.StreamSourceChannel- Overrides:
transferToin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
transferTo
public final long transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target) throws IOException - Specified by:
transferToin interfaceorg.xnio.channels.StreamSourceChannel- Overrides:
transferToin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
read
- Specified by:
readin interfaceReadableByteChannel- Overrides:
readin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
read
- Specified by:
readin interfaceScatteringByteChannel- Overrides:
readin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
read
- Specified by:
readin interfaceScatteringByteChannel- Overrides:
readin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
afterRead
Called after data was read into theByteBuffer- Parameters:
buffer- theByteBufferinto which the data was readposition- the position it was written tolength- the number of bytes there were written- Throws:
IOException- thrown if an error occurs
-
checker
protected void checker(ByteBuffer buffer, int position, int length, boolean complete) throws IOException - Throws:
IOException
-
processFrameData
protected PooledByteBuffer processFrameData(PooledByteBuffer frameData, boolean lastFragmentOfFrame) throws IOException - Overrides:
processFrameDatain classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-