Class AbstractNioByteChannel

    • Constructor Detail

      • AbstractNioByteChannel

        protected AbstractNioByteChannel​(Channel parent,
                                         java.nio.channels.SelectableChannel ch)
        Create a new instance
        Parameters:
        parent - the parent Channel by which this instance was created. May be null
        ch - the underlying SelectableChannel on which it operates
    • Method Detail

      • shutdownInput

        protected abstract ChannelFuture shutdownInput()
        Shutdown the input side of the channel.
      • isInputShutdown0

        protected boolean isInputShutdown0()
      • doWrite0

        protected final int doWrite0​(ChannelOutboundBuffer in)
                              throws java.lang.Exception
        Write objects to the OS.
        Parameters:
        in - the collection which contains objects to write.
        Returns:
        The value that should be decremented from the write quantum which starts at ChannelConfig.getWriteSpinCount(). The typical use cases are as follows:
        • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
        • 1 - if a single call to write data was made to the OS
        • ChannelUtils.WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
        Throws:
        java.lang.Exception - if an I/O exception occurs during write.
      • incompleteWrite

        protected final void incompleteWrite​(boolean setOpWrite)
      • doWriteFileRegion

        protected abstract long doWriteFileRegion​(FileRegion region)
                                           throws java.lang.Exception
        Write a FileRegion
        Parameters:
        region - the FileRegion from which the bytes should be written
        Returns:
        amount the amount of written bytes
        Throws:
        java.lang.Exception
      • doReadBytes

        protected abstract int doReadBytes​(ByteBuf buf)
                                    throws java.lang.Exception
        Read bytes into the given ByteBuf and return the amount.
        Throws:
        java.lang.Exception
      • doWriteBytes

        protected abstract int doWriteBytes​(ByteBuf buf)
                                     throws java.lang.Exception
        Write bytes form the given ByteBuf to the underlying Channel.
        Parameters:
        buf - the ByteBuf from which the bytes should be written
        Returns:
        amount the amount of written bytes
        Throws:
        java.lang.Exception
      • setOpWrite

        protected final void setOpWrite()
      • clearOpWrite

        protected final void clearOpWrite()