Class Decoder

  • Direct Known Subclasses:
    BrotliDecoderChannel

    public class Decoder
    extends java.lang.Object
    Base class for InputStream / Channel implementations.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.nio.ByteBuffer buffer  
      (package private) boolean closed  
      private DecoderJNI.Wrapper decoder  
      (package private) boolean eager  
      private static java.nio.ByteBuffer EMPTY_BUFFER  
      private java.nio.channels.ReadableByteChannel source  
    • Constructor Summary

      Constructors 
      Constructor Description
      Decoder​(java.nio.channels.ReadableByteChannel source, int inputBufferSize)
      Creates a Decoder wrapper.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void attachDictionary​(java.nio.ByteBuffer dictionary)  
      (package private) void close()  
      (package private) int consume​(java.nio.ByteBuffer dst)  
      (package private) int decode()
      Continue decoding.
      static byte[] decompress​(byte[] data)
      Decodes the given data buffer.
      (package private) void discard​(int length)  
      void enableEagerOutput()  
      private void fail​(java.lang.String message)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_BUFFER

        private static final java.nio.ByteBuffer EMPTY_BUFFER
      • source

        private final java.nio.channels.ReadableByteChannel source
      • buffer

        java.nio.ByteBuffer buffer
      • closed

        boolean closed
      • eager

        boolean eager
    • Constructor Detail

      • Decoder

        public Decoder​(java.nio.channels.ReadableByteChannel source,
                       int inputBufferSize)
                throws java.io.IOException
        Creates a Decoder wrapper.
        Parameters:
        source - underlying source
        inputBufferSize - read buffer size
        Throws:
        java.io.IOException
    • Method Detail

      • fail

        private void fail​(java.lang.String message)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • attachDictionary

        void attachDictionary​(java.nio.ByteBuffer dictionary)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • enableEagerOutput

        public void enableEagerOutput()
      • decode

        int decode()
            throws java.io.IOException
        Continue decoding.
        Returns:
        -1 if stream is finished, or number of bytes available in read buffer (> 0)
        Throws:
        java.io.IOException
      • discard

        void discard​(int length)
      • consume

        int consume​(java.nio.ByteBuffer dst)
      • close

        void close()
            throws java.io.IOException
        Throws:
        java.io.IOException
      • decompress

        public static byte[] decompress​(byte[] data)
                                 throws java.io.IOException
        Decodes the given data buffer.
        Throws:
        java.io.IOException