I download in a Microflow a file in bz2, I need to unpackage this package. Can anyone help me with this please seen I am not an Java expert.
Found this Java code, how can I use this in Mendix when I give a filedoc as parameter?
Compress provides factory methods to create input/output streams based on the names of the compressor or archiver format as well as factory methods that try to guess the format of an input stream.
To create a compressor writing to a given output by using the algorithm name:
CompressorOutputStream gzippedOut = new CompressorStreamFactory() .createCompressorOutputStream(CompressorStreamFactory.GZIP, myOutputStream);
Make the factory guess the input format for a given archiver stream:
ArchiveInputStream input = new ArchiveStreamFactory() .createArchiveInputStream(originalInput);
Make the factory guess the input format for a given compressor stream:
CompressorInputStream input = new CompressorStreamFactory() .createCompressorInputStream(originalInput);
Note that there is no way to detect the lzma or Brotli formats so only the two-arg version of createCompressorInputStream can be used. Prior to Compress 1.9 the .Z format hasn't been auto-detected either.
You can use the Apache Commons Compress library.
Use the answer given here: https://stackoverflow.com/questions/4834721/java-read-bz2-file-and-uncompress-parse-on-the-fly/
The inputstreem needed as described in the answers' code can be obtained using the Core.getSystemFileDocumentContent() method.
The answer assumes that the zip contains txt files, so you might need other handling for your zipfile.