Class BZip2CompressorInputStream

    • Constructor Detail

      • BZip2CompressorInputStream

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

        public BZip2CompressorInputStream​(InputStream in,
                                          boolean decompressConcatenated)
                                   throws 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:
        IOException - if the stream content is malformed or an I/O error occurs.
        NullPointerException - if in == null
    • Method Detail

      • count

        protected void count​(int read)
        Increments the counter of already read bytes. Doesn't increment if the EOF has been hit (read == -1)
        Parameters:
        read - the number of bytes read
        Since:
        1.1
      • count

        protected void count​(long read)
        Increments the counter of already read bytes. Doesn't increment if the EOF has been hit (read == -1)
        Parameters:
        read - the number of bytes read
      • getCount

        @Deprecated
        public int getCount()
        Deprecated.
        this method may yield wrong results for large archives, use #getBytesRead instead
        Returns the current number of bytes read from this stream.
        Returns:
        the number of read bytes
      • getBytesRead

        public long getBytesRead()
        Returns the current number of bytes read from this stream.
        Returns:
        the number of read bytes
        Since:
        1.1
      • 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