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

add support flate2::bufread::DeflateDecoder::new_with_buf #169

Open
nil-ref opened this issue Jun 1, 2023 · 0 comments
Open

add support flate2::bufread::DeflateDecoder::new_with_buf #169

nil-ref opened this issue Jun 1, 2023 · 0 comments

Comments

@nil-ref
Copy link

nil-ref commented Jun 1, 2023

I implemented a reader myself, but it can only read up to 32K each time. I tried many methods, and tracked for a long time, and finally found that the problem lies here, zip call flate2::bufread::DeflateDecoder::new is 32K:

impl<R: Read> DeflateDecoder<R> {
    /// Creates a new decoder which will decompress data read from the given
    /// stream.
    pub fn new(r: R) -> DeflateDecoder<R> {
        DeflateDecoder::new_with_buf(r, vec![0; 32 * 1024])
    }
    /// Same as `new`, but the intermediate buffer for data is specified.
    ///
    /// Note that the capacity of the intermediate buffer is never increased,
    /// and it is recommended for it to be large.
    pub fn new_with_buf(r: R, buf: Vec<u8>) -> DeflateDecoder<R> {
        DeflateDecoder {
            inner: bufread::DeflateDecoder::new(BufReader::with_buf(buf, r)),
        }
    }
}

It also provides another interface new_with_buf. But zip does not support it.

@Pr0methean Pr0methean transferred this issue from zip-rs/zip-old Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant