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
ConstructorsModifierConstructorDescriptionprotected
StreamSourceFrameChannel
(WebSocketChannel wsChannel, WebSocketFrameType type, int rsv, boolean finalFragment, PooledByteBuffer pooled, long frameLength, Masker masker, ChannelFunction... functions) protected
StreamSourceFrameChannel
(WebSocketChannel wsChannel, WebSocketFrameType type, PooledByteBuffer pooled, long frameLength) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterRead
(ByteBuffer buffer, int position, int length) Called after data was read into theByteBuffer
protected void
checker
(ByteBuffer buffer, int position, int length, boolean complete) void
protected WebSocketChannel
int
getRsv()
Return the rsv which is used for extensions.getType()
Return theWebSocketFrameType
ornull
if its not known at the calling time.protected void
handleHeaderData
(FrameHeaderData headerData) boolean
Flag to indicate if this frame is the final fragment in a message.protected PooledByteBuffer
processFrameData
(PooledByteBuffer frameData, boolean lastFragmentOfFrame) int
read
(ByteBuffer dst) final long
read
(ByteBuffer[] dsts) long
read
(ByteBuffer[] dsts, int offset, int length) final long
transferTo
(long position, long count, FileChannel target) final long
transferTo
(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 theWebSocketFrameType
ornull
if 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:
transferTo
in interfaceorg.xnio.channels.StreamSourceChannel
- Overrides:
transferTo
in classAbstractFramedStreamSourceChannel<WebSocketChannel,
StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
transferTo
public final long transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target) throws IOException - Specified by:
transferTo
in interfaceorg.xnio.channels.StreamSourceChannel
- Overrides:
transferTo
in classAbstractFramedStreamSourceChannel<WebSocketChannel,
StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Overrides:
read
in classAbstractFramedStreamSourceChannel<WebSocketChannel,
StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
read
- Specified by:
read
in interfaceScatteringByteChannel
- Overrides:
read
in classAbstractFramedStreamSourceChannel<WebSocketChannel,
StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
read
- Specified by:
read
in interfaceScatteringByteChannel
- Overrides:
read
in classAbstractFramedStreamSourceChannel<WebSocketChannel,
StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-
afterRead
Called after data was read into theByteBuffer
- Parameters:
buffer
- theByteBuffer
into 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:
processFrameData
in classAbstractFramedStreamSourceChannel<WebSocketChannel,
StreamSourceFrameChannel, StreamSinkFrameChannel> - Throws:
IOException
-