Add progressbar to BZip2CompressorInputStream
- by bordeux
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?