Monday, January 24, 2011

Filter streams and nasty libraries

Have you ever need a library that does some cool stuff, but you wanted it as "filter stream" and the library did not offer filter stream implementations? And it was either "Ugh, I have to redo it all" or "Ugh, I have to reorganize all" feeling, but all the work was done in that utility already in front of your nose?

Or, did you ever wanted to use GZIP compress on inputStream or decompress on output stream (the opposite what GZIPInputStream and GZIPOutputStream does)?

No problem.

Here is small reusable utility (not deployed yet anywhere, you need to build it locally to toy with it):

and an example of using this stuff in one of the "most nastiest Java library", the canonical LZMA compression utility:

This above is compatible with OS lzma CLI tools even!
Please be gentle, this is still baby code, but any improvement accepted!
Both are ASL 2.0, so enjoy!



No comments: