Class BrotliEncoder.Writer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, java.nio.channels.WritableByteChannel
    Enclosing class:
    BrotliEncoder

    private static final class BrotliEncoder.Writer
    extends java.lang.Object
    implements java.nio.channels.WritableByteChannel
    BrotliEncoder.Writer is the implementation of WritableByteChannel which encodes Brotli data and stores it into ByteBuf.
    • Field Detail

      • writableBuffer

        private ByteBuf writableBuffer
      • brotliEncoderChannel

        private final com.aayushatharva.brotli4j.encoder.BrotliEncoderChannel brotliEncoderChannel
      • closeInitiated

        private boolean closeInitiated
      • isClosed

        private boolean isClosed
    • Constructor Detail

      • Writer

        private Writer​(com.aayushatharva.brotli4j.encoder.Encoder.Parameters parameters,
                       ChannelHandlerContext ctx)
                throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • encode

        private void encode​(ByteBuf msg,
                            boolean preferDirect)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • allocate

        private void allocate​(boolean preferDirect)
      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Specified by:
        write in interface java.nio.channels.WritableByteChannel
        Throws:
        java.io.IOException
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
      • finish

        public void finish​(ChannelPromise promise)
                    throws java.io.IOException
        Throws:
        java.io.IOException