Interface DiscordZstdContext
@NullMarked
public interface DiscordZstdContext
Wraps a Zstandard decompression context, it keeps track of the previous decompressed data,
allowing for greater compression ratios, but the data must be decompressed in the same order.
It can be used to decompress-as-you-consume with
It can be used to decompress-as-you-consume with
InputStreams.
Instances are not thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the context and frees resources.createInputStream(byte[] input) Exceptions thrown by theInputStreamwill invalidate the decompression context, in which case you will need to recreate a new one or callreset(), as well as recreate a gateway connection.voidreset()Resets the current context so it can be used again.
-
Method Details
-
close
void close()Closes the context and frees resources.If this is already closed, this is a no-op.
-
reset
void reset()Resets the current context so it can be used again.- Throws:
IllegalStateException- If the context is closed
-
createInputStream
Exceptions thrown by theInputStreamwill invalidate the decompression context, in which case you will need to recreate a new one or callreset(), as well as recreate a gateway connection.- Parameters:
input- The data to decompress- Returns:
- The new
InputStream - Throws:
IllegalArgumentException- If the provided input isnullIllegalStateException- If the context is closed or in an errored state
-