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

    • Constructor Detail

      • AbstractFramedStreamSinkChannel

        protected AbstractFramedStreamSinkChannel​(C channel)
    • Method Detail

      • transferFrom

        public long transferFrom​(FileChannel src,
                                 long position,
                                 long count)
                          throws IOException
        Specified by:
        transferFrom in interface org.xnio.channels.StreamSinkChannel
        Throws:
        IOException
      • transferFrom

        public long transferFrom​(org.xnio.channels.StreamSourceChannel source,
                                 long count,
                                 ByteBuffer throughBuffer)
                          throws IOException
        Specified by:
        transferFrom in interface org.xnio.channels.StreamSinkChannel
        Throws:
        IOException
      • suspendWrites

        public void suspendWrites()
        Specified by:
        suspendWrites in interface org.xnio.channels.SuspendableWriteChannel
      • isWriteResumed

        public boolean isWriteResumed()
        Specified by:
        isWriteResumed in interface org.xnio.channels.SuspendableWriteChannel
      • wakeupWrites

        public void wakeupWrites()
        Specified by:
        wakeupWrites in interface org.xnio.channels.SuspendableWriteChannel
      • resumeWrites

        public void resumeWrites()
        Specified by:
        resumeWrites in interface org.xnio.channels.SuspendableWriteChannel
      • resumeWritesInternal

        protected void resumeWritesInternal​(boolean wakeup)
      • shutdownWrites

        public void shutdownWrites()
                            throws IOException
        Specified by:
        shutdownWrites in interface org.xnio.channels.SuspendableWriteChannel
        Throws:
        IOException
      • isFinalFrameQueued

        protected boolean isFinalFrameQueued()
      • awaitWritable

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

        public void awaitWritable​(long l,
                                  TimeUnit timeUnit)
                           throws IOException
        Specified by:
        awaitWritable in interface org.xnio.channels.SuspendableWriteChannel
        Throws:
        IOException
      • getWriteThread

        public org.xnio.XnioExecutor getWriteThread()
        Specified by:
        getWriteThread in interface org.xnio.channels.SuspendableWriteChannel
      • getWriteSetter

        public org.xnio.ChannelListener.Setter<? extends S> getWriteSetter()
        Specified by:
        getWriteSetter in interface org.xnio.channels.StreamSinkChannel
        Specified by:
        getWriteSetter in interface org.xnio.channels.SuspendableWriteChannel
      • getCloseSetter

        public org.xnio.ChannelListener.Setter<? extends S> getCloseSetter()
        Specified by:
        getCloseSetter in interface org.xnio.channels.CloseableChannel
        Specified by:
        getCloseSetter in interface org.xnio.channels.StreamSinkChannel
        Specified by:
        getCloseSetter in interface org.xnio.channels.SuspendableWriteChannel
      • 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
      • flush

        public boolean flush()
                      throws IOException
        Specified by:
        flush in interface org.xnio.channels.SuspendableWriteChannel
        Throws:
        IOException
      • isFlushRequiredOnEmptyBuffer

        protected boolean isFlushRequiredOnEmptyBuffer()
      • send

        public boolean send​(PooledByteBuffer pooled)
                     throws IOException
        Send a buffer to this channel.
        Parameters:
        pooled - Pooled ByteBuffer to send. The buffer should have data available. This channel will free the buffer after sending data
        Returns:
        true if the buffer was accepted; false if the channel needs to first be flushed
        Throws:
        IOException - if this channel is closed
      • getAwaitWritableTimeout

        protected long getAwaitWritableTimeout()
        Return the timeout used by awaitWritable.
        Returns:
        the awaitWritable timeout, in milliseconds
      • writeFinal

        public long writeFinal​(ByteBuffer[] srcs,
                               int offset,
                               int length)
                        throws IOException
        Specified by:
        writeFinal in interface org.xnio.channels.StreamSinkChannel
        Throws:
        IOException
      • writeFinal

        public long writeFinal​(ByteBuffer[] srcs)
                        throws IOException
        Specified by:
        writeFinal in interface org.xnio.channels.StreamSinkChannel
        Throws:
        IOException
      • writeFinal

        public int writeFinal​(ByteBuffer src)
                       throws IOException
        Specified by:
        writeFinal in interface org.xnio.channels.StreamSinkChannel
        Throws:
        IOException
      • isLastFrame

        protected abstract boolean isLastFrame()
        Returns:
        true If this is the last frame that will be sent on this connection
      • isReadyForFlush

        public boolean isReadyForFlush()
        Returns:
        true if the channel is ready to be flushed. When a channel is ready to be flushed nothing should modify the buffer, as it may be written out by another thread.
      • isWritesShutdown

        public boolean isWritesShutdown()
        Returns true writes have been shutdown
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface Channel
        Specified by:
        isOpen in interface org.xnio.channels.SuspendableWriteChannel
      • channelForciblyClosed

        protected void channelForciblyClosed()
                                      throws IOException
        Called when a channel has been forcibly closed, and data (frames) have already been written. The action this should take is protocol dependent, e.g. for SPDY a RST_STREAM should be sent, for websockets the channel should be closed. By default this will just close the underlying channel
        Throws:
        IOException
      • 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
      • handleFlushComplete

        protected void handleFlushComplete​(boolean finalFrame)
      • isFirstDataWritten

        protected boolean isFirstDataWritten()
      • markBroken

        public void markBroken()
      • getChannel

        public C getChannel()
      • isBroken

        public boolean isBroken()
      • isBufferFull

        public boolean isBufferFull()