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
You're likely here if you want to use Zstd decompression for your Discord bot!
This is compatible with Java 8+.
dependencies {
runtimeOnly("dev.freya02:discord-zstd-java-jni-impl:VERSION") // TODO replace VERSION with current release
}<dependency>
<groupId>dev.freya02</groupId>
<artifactId>discord-zstd-java-jni-impl</artifactId>
<version>VERSION</version> <!-- TODO replace VERSION with current release -->
<scope>runtime</scope>
</dependency>As a bot developer, you don't need to do anything.
If you want to load a different version of the native library,
you 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.
You will only need the dev.freya02:discord-zstd-java-api:VERSION dependency, it is compatible with Java 8+.
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