Class AbstractLZ77CompressorInputStream

    • Constructor Detail

      • AbstractLZ77CompressorInputStream

        public AbstractLZ77CompressorInputStream​(java.io.InputStream is,
                                                 int windowSize)
                                          throws java.io.IOException
        Creates a new LZ77 input stream.
        Parameters:
        is - An InputStream to read compressed data from
        windowSize - Size of the window kept for back-references, must be bigger than the biggest offset expected.
        Throws:
        java.io.IOException - if reading fails
        java.lang.IllegalArgumentException - if windowSize is not bigger than 0
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • 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
      • available

        public int available()
        Overrides:
        available in class java.io.InputStream
      • getSize

        public int getSize()
        Get the uncompressed size of the stream
        Returns:
        the uncompressed size
      • prefill

        public void prefill​(byte[] data)
        Adds some initial data to fill the window with.

        This is used if the stream has been cut into blocks and back-references of one block may refer to data of the previous block(s). One such example is the LZ4 frame format using block dependency.

        Parameters:
        data - the data to fill the window with.
        Throws:
        java.lang.IllegalStateException - if the stream has already started to read data
      • getCompressedCount

        public long getCompressedCount()
        Specified by:
        getCompressedCount in interface InputStreamStatistics
        Returns:
        the amount of raw or compressed bytes read by the stream
        Since:
        1.17