Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Information Provided
-
1.24.0
-
None
-
None
-
Plain Java in IntelliJ
Description
I tried to uncompress a big file (a few MBs) of bz2 file using
BZip2CompressorInputStream, the max output I can get is 900000 in size.
The following example
-rw-r--r-- 1 ahmadin staff 167283773 Nov 9 15:50 test.tar.bz2 -rw-r--r-- 1 ahmadin staff 900000 Nov 9 15:51 test.tar
The code I use is the example from https://commons.apache.org/proper/commons-compress/examples.html
public class BZ2Extract { public static void main(String[] args) { int buffersize = 102400; InputStream fin = null; try { fin = Files.newInputStream(Paths.get("/cfm/test.tar.bz2")); BufferedInputStream in = new BufferedInputStream(fin); OutputStream out = Files.newOutputStream(Paths.get("/cfm/test.tar")); 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 (IOException e) { throw new RuntimeException(e); } } }
If I use bzip2 on my mac to uncompress, the file size is 1199749120 after uncompressing