Class AbstractFramedStreamSourceChannel<C extends AbstractFramedChannel<C,R,S>,R extends AbstractFramedStreamSourceChannel<C,R,S>,S extends AbstractFramedStreamSinkChannel<C,R,S>>

java.lang.Object
io.undertow.server.protocol.framed.AbstractFramedStreamSourceChannel<C,R,S>
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
Direct Known Subclasses:
AbstractAjpClientStreamSourceChannel, AbstractHttp2StreamSourceChannel, StreamSourceFrameChannel

public abstract class AbstractFramedStreamSourceChannel<C extends AbstractFramedChannel<C,R,S>,R extends AbstractFramedStreamSourceChannel<C,R,S>,S extends AbstractFramedStreamSinkChannel<C,R,S>> extends Object implements org.xnio.channels.StreamSourceChannel
Source channel, used to receive framed messages.
Author:
Stuart Douglas, Flavia Rainone
  • Constructor Details

    • AbstractFramedStreamSourceChannel

      public AbstractFramedStreamSourceChannel(C framedChannel)
    • AbstractFramedStreamSourceChannel

      public AbstractFramedStreamSourceChannel(C framedChannel, PooledByteBuffer data, long frameDataRemaining)
  • Method Details

    • transferTo

      public long transferTo(long position, long count, FileChannel target) throws IOException
      Specified by:
      transferTo in interface org.xnio.channels.StreamSourceChannel
      Throws:
      IOException
    • transferTo

      public long transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel streamSinkChannel) throws IOException
      Specified by:
      transferTo in interface org.xnio.channels.StreamSourceChannel
      Throws:
      IOException
    • getMaxStreamSize

      public long getMaxStreamSize()
    • setMaxStreamSize

      public void setMaxStreamSize(long maxStreamSize)
    • suspendReads

      public void suspendReads()
      Specified by:
      suspendReads in interface org.xnio.channels.SuspendableReadChannel
    • complete

      protected void complete() throws IOException
      Method that is invoked when all data has been read.
      Throws:
      IOException
    • isComplete

      protected boolean isComplete()
    • resumeReads

      public void resumeReads()
      Specified by:
      resumeReads in interface org.xnio.channels.SuspendableReadChannel
    • isReadResumed

      public boolean isReadResumed()
      Specified by:
      isReadResumed in interface org.xnio.channels.SuspendableReadChannel
    • wakeupReads

      public void wakeupReads()
      Specified by:
      wakeupReads in interface org.xnio.channels.SuspendableReadChannel
    • addCloseTask

      public void addCloseTask(org.xnio.ChannelListener<R> channelListener)
    • shutdownReads

      public void shutdownReads() throws IOException
      Specified by:
      shutdownReads in interface org.xnio.channels.SuspendableReadChannel
      Throws:
      IOException
    • lastFrame

      protected void lastFrame()
    • isLastFrame

      protected boolean isLastFrame()
    • awaitReadable

      public void awaitReadable() throws IOException
      Specified by:
      awaitReadable in interface org.xnio.channels.SuspendableReadChannel
      Throws:
      IOException
    • awaitReadable

      public void awaitReadable(long l, TimeUnit timeUnit) throws IOException
      Specified by:
      awaitReadable in interface org.xnio.channels.SuspendableReadChannel
      Throws:
      IOException
    • dataReady

      protected void dataReady(FrameHeaderData headerData, PooledByteBuffer frameData)
      Called when data has been read from the underlying channel.
      Parameters:
      headerData - The frame header data. This may be null if the data is part of a an existing frame
      frameData - The frame data
    • updateFrameDataRemaining

      protected long updateFrameDataRemaining(PooledByteBuffer frameData, long frameDataRemaining)
    • processFrameData

      protected PooledByteBuffer processFrameData(PooledByteBuffer data, boolean lastFragmentOfFrame) throws IOException
      Throws:
      IOException
    • handleHeaderData

      protected void handleHeaderData(FrameHeaderData headerData)
    • getReadThread

      public org.xnio.XnioExecutor getReadThread()
      Specified by:
      getReadThread in interface org.xnio.channels.SuspendableReadChannel
    • getReadSetter

      public org.xnio.ChannelListener.Setter<? extends R> getReadSetter()
      Specified by:
      getReadSetter in interface org.xnio.channels.StreamSourceChannel
      Specified by:
      getReadSetter in interface org.xnio.channels.SuspendableReadChannel
    • getCloseSetter

      public org.xnio.ChannelListener.Setter<? extends R> getCloseSetter()
      Specified by:
      getCloseSetter in interface org.xnio.channels.CloseableChannel
      Specified by:
      getCloseSetter in interface org.xnio.channels.StreamSourceChannel
      Specified by:
      getCloseSetter in interface org.xnio.channels.SuspendableReadChannel
    • getWorker

      public org.xnio.XnioWorker getWorker()
      Specified by:
      getWorker in interface org.xnio.channels.CloseableChannel
    • getIoThread

      public org.xnio.XnioIoThread getIoThread()
      Specified by:
      getIoThread in interface org.xnio.channels.CloseableChannel
    • supportsOption

      public boolean supportsOption(org.xnio.Option<?> option)
      Specified by:
      supportsOption in interface org.xnio.channels.Configurable
    • getOption

      public <T> T getOption(org.xnio.Option<T> tOption) throws IOException
      Specified by:
      getOption in interface org.xnio.channels.Configurable
      Throws:
      IOException
    • setOption

      public <T> T setOption(org.xnio.Option<T> tOption, T t) throws IllegalArgumentException, IOException
      Specified by:
      setOption in interface org.xnio.channels.Configurable
      Throws:
      IllegalArgumentException
      IOException
    • read

      public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
      Specified by:
      read in interface ScatteringByteChannel
      Throws:
      IOException
    • read

      public long read(ByteBuffer[] dsts) throws IOException
      Specified by:
      read in interface ScatteringByteChannel
      Throws:
      IOException
    • read

      public int read(ByteBuffer dst) throws IOException
      Specified by:
      read in interface ReadableByteChannel
      Throws:
      IOException
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface Channel
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.xnio.channels.CloseableChannel
      Specified by:
      close in interface InterruptibleChannel
    • channelForciblyClosed

      protected void channelForciblyClosed()
    • getFramedChannel

      protected C getFramedChannel()
    • getReadFrameCount

      protected int getReadFrameCount()
    • markStreamBroken

      protected void markStreamBroken()
      Called when this stream is no longer valid. Reads from the stream will result in an exception.