[
https://issues.apache.org/jira/browse/COMPRESS-467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16656266#comment-16656266
]
Stefan Bodewig commented on COMPRESS-467:
-----------------------------------------
I see. Your file consists of multiple bz2 streams, you need to enable
"decompressConcatenated" be using the two-arg constructor of
{{BZip2CompressorInputStream}} passing in {{true}} as the second argument. I.e.
{code}
public static void main(String[] args) throws Exception {
try (BZip2CompressorInputStream i = new BZip2CompressorInputStream(new
FileInputStream("HS_H08_20180927_0600_B02_FLDK_R10_S0110.DAT.bz2"), true);
OutputStream o = new FileOutputStream("test")) {
IOUtils.copy(i, o);
}
}
{code}
The result I get is identical to the one {{bunzip2}} creates on my Linux system.
> Could not unzip the file properly
> ---------------------------------
>
> Key: COMPRESS-467
> URL: https://issues.apache.org/jira/browse/COMPRESS-467
> Project: Commons Compress
> Issue Type: Bug
> Environment: Window 7
> Reporter: Yang Lin
> Priority: Major
> Labels: windows
> Attachments: HS_H08_20180927_0600_B02_FLDK_R10_S0110.DAT.bz2
>
>
> When I use WinRAR unzip one file, I can get the result file properly which
> size is about 24,200,000 bytes. But I use commons-compress unzip this file,
> can only get 900,000 bytes(Operation process: sourceFile -> byte[] ->
> InputStream). In another way to unzip this file using commons-compress,
> sourceFile -> InputStream, throw Exception: java.io.IOException: Stream is
> not in the BZip2 format, at
> org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.init(BZip2CompressorInputStream.java:261).
> Thank you in advance!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)