tukaani-project / xz-java

XZ for Java
https://tukaani.org/xz/java.html
BSD Zero Clause License
23 stars 14 forks source link

[Feature Request]: Support preset dictionary. #5

Closed prgm767 closed 2 months ago

prgm767 commented 1 year ago

Describe the Feature

The scaffolding is already there, but it looks like it it not implemented.

Exception in thread "main" java.lang.IllegalArgumentException: XZ doesn't support a preset dictionary for now

Could it be?

Expected Complications

No response

Will I try to implement this new feature?

No

Larhzu commented 2 months ago

Sorry for the unreasonable delay.

Preset dictionary works with raw LZMA and LZMA2 streams. It's not supported in .xz or .lzma files. There are no plans to add support for it into the .xz format for now.

The implementation with raw streams is a bit weak because initializing the encoder with a big preset dictionary is expensive but there is no API to reuse the initialized state to make it faster to compress multiple files with the same settings. This is true in both XZ for Java and XZ Utils.