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 WebSocketFrameTypetype
-
Constructor Summary
Constructors Modifier Constructor Description protectedStreamSourceFrameChannel(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterRead(ByteBuffer buffer, int position, int length)Called after data was read into theByteBufferprotected voidchecker(ByteBuffer buffer, int position, int length, boolean complete)voidfinalFrame()protected WebSocketChannelgetFramedChannel()intgetRsv()Return the rsv which is used for extensions.WebSocketFrameTypegetType()Return theWebSocketFrameTypeornullif its not known at the calling time.WebSocketChannelgetWebSocketChannel()protected voidhandleHeaderData(FrameHeaderData headerData)booleanisFinalFragment()Flag to indicate if this frame is the final fragment in a message.protected PooledByteBufferprocessFrameData(PooledByteBuffer frameData, boolean lastFragmentOfFrame)intread(ByteBuffer dst)longread(ByteBuffer[] dsts)longread(ByteBuffer[] dsts, int offset, int length)longtransferTo(long position, long count, FileChannel target)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 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 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
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:
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
public int read(ByteBuffer dst) throws IOException
- Specified by:
readin interfaceReadableByteChannel- Overrides:
readin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>- Throws:
IOException
-
read
public final long read(ByteBuffer[] dsts) throws IOException
- Specified by:
readin interfaceScatteringByteChannel- Overrides:
readin classAbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>- Throws:
IOException
-
read
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
- Specified by:
readin interfaceScatteringByteChannel- Overrides:
readin 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- 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
-
-