Class BZip2CompressorInputStream

    • Constructor Detail

      • BZip2CompressorInputStream

        public BZip2CompressorInputStream​(java.io.InputStream in)
                                   throws java.io.IOException
        Constructs a new BZip2CompressorInputStream which decompresses bytes read from the specified stream. This doesn't support decompressing concatenated .bz2 files.
        Parameters:
        in - the InputStream from which this object should be created
        Throws:
        java.io.IOException - if the stream content is malformed or an I/O error occurs.
        java.lang.NullPointerException - if in == null
      • BZip2CompressorInputStream

        public BZip2CompressorInputStream​(java.io.InputStream in,
                                          boolean decompressConcatenated)
                                   throws java.io.IOException
        Constructs a new BZip2CompressorInputStream which decompresses bytes read from the specified stream.
        Parameters:
        in - the InputStream from which this object should be created
        decompressConcatenated - if true, decompress until the end of the input; if false, stop after the first .bz2 stream and leave the input position to point to the next byte after the .bz2 stream
        Throws:
        java.io.IOException - if in == null, the stream content is malformed, or an I/O error occurs.
    • Method Detail

      • 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[] dest,
                        int offs,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • 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
      • 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
      • matches

        public static boolean matches​(byte[] signature,
                                      int length)
        Checks if the signature matches what is expected for a bzip2 file.
        Parameters:
        signature - the bytes to check
        length - the number of bytes to check
        Returns:
        true, if this stream is a bzip2 compressed stream, false otherwise
        Since:
        1.1