Class BrotliInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class BrotliInputStream
    extends java.io.InputStream
    InputStream decorator that decompresses brotli data.

    Not thread-safe.

    • Constructor Summary

      Constructors 
      Constructor Description
      BrotliInputStream​(java.io.InputStream source)
      Creates a InputStream wrapper that decompresses brotli data.
      BrotliInputStream​(java.io.InputStream source, int byteReadBufferSize)
      Creates a InputStream wrapper that decompresses brotli data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      int read()
      int read​(byte[] destBuffer, int destOffset, int destLen)
      • Methods inherited from class java.io.InputStream

        available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_INTERNAL_BUFFER_SIZE

        public static final int DEFAULT_INTERNAL_BUFFER_SIZE
        See Also:
        Constant Field Values
    • Constructor Detail

      • BrotliInputStream

        public BrotliInputStream​(java.io.InputStream source)
                          throws java.io.IOException
        Creates a InputStream wrapper that decompresses brotli data.

        For byte-by-byte reading (read()) internal buffer with DEFAULT_INTERNAL_BUFFER_SIZE size is allocated and used.

        Will block the thread until first kilobyte of data of source is available.

        Parameters:
        source - underlying data source
        Throws:
        java.io.IOException - in case of corrupted data or source stream problems
      • BrotliInputStream

        public BrotliInputStream​(java.io.InputStream source,
                                 int byteReadBufferSize)
                          throws java.io.IOException
        Creates a InputStream wrapper that decompresses brotli data.

        For byte-by-byte reading (read()) internal buffer of specified size is allocated and used.

        Will block the thread until first kilobyte of data of source is available.

        Parameters:
        source - compressed data source
        byteReadBufferSize - size of internal buffer used in case of byte-by-byte reading
        Throws:
        java.io.IOException - in case of corrupted data or source stream problems
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] destBuffer,
                        int destOffset,
                        int destLen)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException