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
`protected WebSocketFrameType` `type`

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

### Constructor Summary

Constructors
`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
`protected void` `afterRead(ByteBuffer buffer, int position, int length)` Called after data was read into the `ByteBuffer`
`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 the `WebSocketFrameType` or `null` 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 count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target)`
`long` `transferTo(long position, long count, FileChannel 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 the `WebSocketFrameType` or `null` 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()

Overrides:
  `getFramedChannel` in class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`

#### getWebSocketChannel

    public WebSocketChannel getWebSocketChannel()

#### finalFrame

    public void finalFrame()

#### handleHeaderData

    protected void handleHeaderData(FrameHeaderData headerData)

Overrides:
  `handleHeaderData` in class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`

#### transferTo

    public final long transferTo(long position,
                                 long count,
                                 FileChannel target)
                          throws IOException

Specified by:
  `transferTo` in interface `org.xnio.channels.StreamSourceChannel`
Overrides:
  `transferTo` in class `AbstractFramedStreamSourceChannel<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 interface `org.xnio.channels.StreamSourceChannel`
Overrides:
  `transferTo` in class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`
Throws:
  `IOException`

#### read

    public int read(ByteBuffer dst)
             throws IOException

Specified by:
  `read` in interface `ReadableByteChannel`
Overrides:
  `read` in class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`
Throws:
  `IOException`

#### read

    public final long read(ByteBuffer[] dsts)
                    throws IOException

Specified by:
  `read` in interface `ScatteringByteChannel`
Overrides:
  `read` in class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`
Throws:
  `IOException`

#### read

    public long read(ByteBuffer[] dsts,
                     int offset,
                     int length)
              throws IOException

Specified by:
  `read` in interface `ScatteringByteChannel`
Overrides:
  `read` in class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`
Throws:
  `IOException`

#### afterRead

    protected void afterRead(ByteBuffer buffer,
                             int position,
                             int length)
                      throws IOException

Called after data was read into the `ByteBuffer`

Parameters:
  `buffer` - the `ByteBuffer` into which the data was read
  `position` - the position it was written to
  `length` - 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 class `AbstractFramedStreamSourceChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>`
Throws:
  `IOException`