Comments (10)
Hi,
Thanks for the interest. You are right it does not handle this case yet. I will take a look to add it with the next release (0.8) that's coming soon. There is also a re-work in progress of the Zstd streaming API (https://github.com/Cyan4973/zstd/issues/271) that will significantly simplify these bindings.
from zstd-jni.
Ah, yes. I am watching zstd the main repo too. Waiting for the new streaming api.
from zstd-jni.
@advancedxy , I just pushed the zstream branch that is based on the new streaming API and is also updated to zstd-1.0.0. I have added support for decoding multiple frames. You can try it.
My intention is to release it this week after figuring out the interaction of the multi-frame support and the ability to decode files that are not yet finished.
from zstd-jni.
Hi @luben, thanks for your info.
After check your implementation, there are some questions in my mind:
- https://github.com/luben/zstd-jni/blob/zstream/src/main/java/com/github/luben/zstd/ZstdInputStream.java#L78
toRead can be 1 if the output is not fully flushed according to the api documentation. This case is not handled? - https://github.com/luben/zstd-jni/blob/zstream/src/main/java/com/github/luben/zstd/ZstdInputStream.java#L28
srcPos looks never being used, is it necessary to declare the variable? - what about skippable frame? can toRead be larger than recommendedDInSize() in skippable frame, and results an IndexOutOfBoundsException in https://github.com/luben/zstd-jni/blob/zstream/src/main/java/com/github/luben/zstd/ZstdInputStream.java#L78
from zstd-jni.
@advancedxy , thank for looking up.
- I tried to read from upstream only when toRead > 1 but it does not function properly. I don't know why. Will investigate and write a test for the worst case (reading 1 byte at a time) to see if we handle it correctly. On another hand I just added an initial implementation of available() that will return 1 if there is a data in the output buffer.
- Good catch. I am filling the input buffer only with the requested amount so there is no risk for not being
able to consume it all. - Good question. I will ask Yann about it with bunch of other question I am gathering:
- could the amount of available data in the output buffer be exposed so that the available() method can return in. Also what's expected as next invocation of decompressStream when the previous one returned 1.
- could he implement a "skip" operation that will be like decompressStream but without copying it in the destination buffer.
from zstd-jni.
Hi, @luben look at the decompressStream code https://github.com/facebook/zstd/blob/master/lib/decompress/zstd_decompress.c#L1553 (It's still in flush stage if not fully flushed), I believe another decompressStream call should be made(and maybe multiple calls). Of cause, you should always consult Yann for that.
Hopes that can fix the case 1.
As for 3rd question, please make the conversion public(Issues?) or cc me if you are going to communicate by email, thanks very much.
from zstd-jni.
Yes, sure... actually I made a progress on 1 but I am not satisfied. I will CC you on the conversion.
from zstd-jni.
@advancedxy : 4a61bbe fixes some of the discussed issues but is quite ugly - let's hope we will find a better solution.
from zstd-jni.
@advancedxy , just released the 1.0.0 based on the Yann's suggestions. I believe it handles all discussed cases as well as decompressing multiple frames.
from zstd-jni.
supported and tested in v1.0.0
from zstd-jni.
Related Issues (20)
- ZstdInputStreamNoFinalizer.skip performs poorly when skipping full frames HOT 3
- Cannot unpack libzstd-jni-1.5.4-2 ?!?! When using virtual threads on Correto-21 + Windows HOT 11
- Tradeoffs with "closeOnFlush"... HOT 1
- Stuck when parallel compression is enabled HOT 1
- Decompression error: Unknown frame descriptor
- `apache-commons` fails to find `zstd-jni` on some `jna`/`jna-platform` versions HOT 1
- Unit test regression after 1.5.2 - ZstdIOException: Unknown frame descriptor HOT 6
- Limit the maximal block size while decompress HOT 2
- decompressedSize error
- Add ZstdBufferCompressingStream
- No way to only decompress part of a file without decompressing whole thing HOT 1
- Native memory leak from using "By-reference" variants
- Support for ZSTD_CCtx_refPrefix()
- Allow choosing the path where the native library is extracted using a system property HOT 1
- java.lang.UnsatisfiedLinkError: com.github.luben.zstd.ZstdOutputStreamNoFinalizer.createCStream() on native executable HOT 1
- Unsupported OS/arch, cannot find /linux/aarch_64/libzstd-jni-1.5.6-3.so or load zstd-jni-1.5.6-3 from system libraries. HOT 2
- Caused by: org.osgi.framework.BundleException: Unable to resolve fi.i4ware.dark HOT 4
- Question about buffer size when streaming HOT 3
- MacOS 10.14.6 incompatible dylib binary HOT 8
- Invalid Java module HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zstd-jni.