Lightweight modular support for Zstandard streaming decompression, for JVM Discord API wrappers.
- Linux: x86-64, aarch64, armhf
- Windows: x86-64, aarch64
- macOS (darwin): x86-64, aarch64
See the JDA integration module.
If you decide to integrate this library into yours,
you will only need the dev.freya02:discord-zstd-java-api:VERSION dependency, it is compatible with Java 8+.
Your users will need to install an implementation, we recommend using discord-zstd-java-jni-impl.
The users can also load a different version of the native library,
they can do so by calling ZstdNativesLoader.load(Path) or loadFromJar(String).
These functions will return false if the natives were already loaded, as they can't be replaced.
The main interface is DiscordZstd, you can get an instance with DiscordZstdProvider.get().
Then, you can either:
- Do bulk processing with a decompressor obtained with
DiscordZstd#createDecompressorand kept per gateway connection, callingZstdDecompressor#decompresson each gateway message - Process gradually with a context obtained from
DiscordZstd#createContextand kept per gateway connection, then making input streams withZstdContext#createInputStreamfrom each gateway message
You can also provide an API in your library, this way users can choose to use any decompression library they want. After creating your API, please submit a pull request here with a new module which implements that API.