Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set dictSize on lzma2_decompress #12

Open
jimliang opened this issue Oct 24, 2019 · 7 comments
Open

How to set dictSize on lzma2_decompress #12

jimliang opened this issue Oct 24, 2019 · 7 comments

Comments

@jimliang
Copy link

In https://mvnrepository.com/artifact/com.github.veithen.cosmos.bootstrap/org.tukaani.xz
I see

package org.tukaani.xz;

public class LZMA2InputStream extends InputStream {
   
   ...
    public LZMA2InputStream(InputStream in, int dictSize) {
        this(in, dictSize, (byte[])null);
    }

dictSize is a param to construct LZMA2InputStream

@gendx
Copy link
Owner

gendx commented Oct 24, 2019

The LZMA format contains a header which specifies the dictionary size to use: https://github.com/gendx/lzma-rs/blob/master/src/decode/lzma.rs#L46

So lzma-rs just follows whatever dictionary size is written in the compressed stream, there is currently no way to override this value, nor to set limits on it.

@XVilka
Copy link
Contributor

XVilka commented Nov 13, 2019

Some formats specify the properties in a different format. It would be awesome to have the "raw" function with everything as a parameter instead.

@gendx
Copy link
Owner

gendx commented Nov 14, 2019

Do you have a reference to the code and documentation for such "some formats"? Otherwise it's hard to add the feature you wish. Feel free to send a pull-request as well (with supporting references, example files, etc.).

@jimliang
Copy link
Author

xz for java: https://tukaani.org/xz/java.html
see LZMAInputStream , LZMA2InputStream
@gendx

@chyyran
Copy link
Contributor

chyyran commented Mar 18, 2022

I am working on porting libchdr to Rust, which directly interfaces with the LZMA SDK and sets the dictSize and other LZMA params explicitly.

My current solution is to vendor lzma-rs to expose the required options in Stream.

@gendx
Copy link
Owner

gendx commented May 30, 2022

I assume this issue is the same feature request as #72?

@chyyran
Copy link
Contributor

chyyran commented Aug 5, 2022

#74 covers this for LZMA1, but I'm not sure how the current design of the LZMA2 decoder can take a useful dict_size parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants