commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Meyer (JIRA)" <>
Subject [jira] [Commented] (COMPRESS-207) add notifier support for new block in BZip2CompressorInputStream
Date Sun, 27 Mar 2016 17:11:25 GMT


Thomas Meyer commented on COMPRESS-207:

> I'm not convinced the extra initBlock call is correct, could you explain why you think
it is needed?

I think I did move the call from the constructor to START_BLOCK_STATE, so you could position
to the first bzip2 block in the underlying input stream and call resetBlock() the state machine
would then consume the block headers and so on. I think this was the idea of the move here

> Your use case for resetBlock makes me think you won't like the events I suggest as they
don't give you the exact position on the underlying stream at all. Of course this could be
added. I've reused what we return in getBytesRead, which counts the uncompressed bytes. 

yes, I just checked the new branch in git, and yes the change is nice, but not my use case

Regarding "they don't give you the exact position on the underlying stream at all". I think
this counting can actually be done in the underlying input stream, at least that is what I
did. See this "bridge from a RandomAccessFile to an InputStream, which can be used as an undlerying
InputStream for the BZip2CompressorInputStream!

> add notifier support for new block in BZip2CompressorInputStream
> ----------------------------------------------------------------
>                 Key: COMPRESS-207
>                 URL:
>             Project: Commons Compress
>          Issue Type: New Feature
>          Components: Compressors
>    Affects Versions: 1.4.1
>            Reporter: Thomas Meyer
>            Priority: Minor
>              Labels: API, bzip
>         Attachments: 0001-Add-notifier-support-for-new-block-in-BZip2Compresso.patch,
BZip2CompressorInputStream-add-newBlock-notifier.patch, BZip2CompressorInputStream-add-newBlock-notifier.patch,
> hi,
> attached patch enables an program to add a listener when a new bzip2
> block is detected.
> The notifier is called with:
>  - xxx.newBlock(this, currBlockPosition)
> - this = the current BZip2CompressorInputStream object
> - currBlockPosition = The offset (i.e. start position) in the compressed
> input stream of the current block

This message was sent by Atlassian JIRA

View raw message