[
https://issues.apache.org/jira/browse/COMPRESS-537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17127601#comment-17127601
]
Frotty commented on COMPRESS-537:
---------------------------------
[~bodewig] Thanks a lot for your quick response. Indeed, that was the problem.
> SevenZipOutputFile with DEFLATE compression is incorrectly decompressed
> -----------------------------------------------------------------------
>
> Key: COMPRESS-537
> URL: https://issues.apache.org/jira/browse/COMPRESS-537
> Project: Commons Compress
> Issue Type: Bug
> Affects Versions: 1.20
> Reporter: Frotty
> Priority: Major
> Attachments: roxpack.atlas
>
>
> I create a 7zip archive and then load files from it. Using LZMA or BZIP2
> works, but when I change it to DEFLATE the files aren't loaded correctly,
> parts of them are missing.
> Example kotlin code:
>
> {code:java}
> public fun test() {
> // SAVE
> val target = File("target.7z")
> val sevenZOutput = SevenZOutputFile(target)
> sevenZOutput.setContentCompression(SevenZMethod.DEFLATE)
> val file = File("roxpack.atlas")
> val entry = sevenZOutput.createArchiveEntry(file, "roxpack.atlas")
> sevenZOutput.putArchiveEntry(entry)
> sevenZOutput.write(Files.readAllBytes(file.toPath()))
> sevenZOutput.closeArchiveEntry()
> sevenZOutput.close()
> // LOAD
> val s7f = SevenZFile(target)
> s7f.use {
> var nextEntry = it.nextEntry
> do {
> if (nextEntry.name == entry.name) {
> val content = ByteArray(nextEntry.size.toInt())
> s7f.read(content)
> // with DEFLATE content array contains only 0's at the end,
> content string is cut off
> println(String(content))
> return
> }
> nextEntry = it.nextEntry
> } while (nextEntry != null)
> }
> }
> {code}
> When I extract the file using 7zip GUI tool, the file is intact, so the
> problem lies within the decompression. And again, this all works fine with
> LZMA and BZIP2.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)