Add progressbar to BZip2CompressorInputStream

Posted by bordeux on Stack Overflow See other posts from Stack Overflow or by bordeux
Published on 2012-04-01T11:23:17Z Indexed on 2012/04/01 11:30 UTC
Read the original article Hit count: 189

Filed under:
|

This is my code:

public void extract(String input_f, String output_f){
    int buffersize = 1024;
    FileInputStream in;
    try {
        in = new FileInputStream(input_f);
        FileOutputStream out = new FileOutputStream(output_f);
        BZip2CompressorInputStream bzIn = new BZip2CompressorInputStream(in);
        final byte[] buffer = new byte[buffersize];
        int n = 0;

        while (-1 != (n = bzIn.read(buffer))) {
            out.write(buffer, 0, n);
        }
        out.close();
        bzIn.close();
        } catch (Exception e) {
        throw new Error(e.getMessage());
    }
}

How can i add progress bar to extract task, or how can i get the compressed file size?

© Stack Overflow or respective owner

Related posts about java

Related posts about android