[ https://issues.apache.org/jira/browse/SANDBOX-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676228#action_12676228 ]
Ingo Rockel commented on SANDBOX-286: ------------------------------------- The Testcase looks like this: CompressorInputStream in = new CompressorStreamFactory().createCompressorInputStream("bzip2", new FileInputStream("test.bz2")); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String testString while(reader.ready()) { testString = reader.readLine(); } reader.close(); This code simply reads anything, because InputStreamReader calls "available()" on the underlying stream before reading data and the BZip2CompressorInputStream doesn't implement it, it only has the default method from InputStream, which returns "0". My hack works fine for me here, but because of the block orientation of the stream simply calling super.available() might fail in some cases. > BZip2CompressorInputStream doesn't work if wrapped into InputStreamReader > ------------------------------------------------------------------------- > > Key: SANDBOX-286 > URL: https://issues.apache.org/jira/browse/SANDBOX-286 > Project: Commons Sandbox > Issue Type: Bug > Components: Compress > Affects Versions: Nightly Builds > Environment: Unix > Reporter: Ingo Rockel > > The BZip2CompressorInputStream doesn't work if wrapped into InputStreamReader > because it doesn't implement "public int available()" from InputStream. > Adding the following method to BZip2CompressorInputStream fixes the problem: > public int available() throws IOException { > return(in.available()); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.