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
Fields Modifier and Type Field Description protected WebSocketFrameType
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
finalFrame()
protected WebSocketChannel
getFramedChannel()
int
getRsv()
Return the rsv which is used for extensions.WebSocketFrameType
getType()
Return theWebSocketFrameType
ornull
if its not known at the calling time.WebSocketChannel
getWebSocketChannel()
protected void
handleHeaderData(FrameHeaderData headerData)
boolean
isFinalFragment()
Flag to indicate if this frame is the final fragment in a message.protected PooledByteBuffer
processFrameData(PooledByteBuffer frameData, boolean lastFragmentOfFrame)
int
read(ByteBuffer dst)
long
read(ByteBuffer[] dsts)
long
read(ByteBuffer[] dsts, int offset, int length)
long
transferTo(long position, long count, FileChannel target)
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 Detail
-
type
protected final WebSocketFrameType type
-
-
Constructor Detail
-
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 Detail
-
getType
public WebSocketFrameType 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
protected WebSocketChannel getFramedChannel()
-
getWebSocketChannel
public WebSocketChannel getWebSocketChannel()
-
finalFrame
public void finalFrame()
-
handleHeaderData
protected void handleHeaderData(FrameHeaderData headerData)
-
transferTo
public final long transferTo(long position, long count, FileChannel target) throws IOException
- 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
public int read(ByteBuffer dst) throws IOException
- Specified by:
read
in interfaceReadableByteChannel
- Overrides:
read
in classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
- Throws:
IOException
-
read
public final long read(ByteBuffer[] dsts) throws IOException
- Specified by:
read
in interfaceScatteringByteChannel
- Overrides:
read
in classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
- Throws:
IOException
-
read
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
- Specified by:
read
in interfaceScatteringByteChannel
- Overrides:
read
in classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
- Throws:
IOException
-
afterRead
protected void afterRead(ByteBuffer buffer, int position, int length) throws IOException
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
-
-