Class ThreadLocalCompressionProvider
java.lang.Object
com.viaversion.viarewind.api.compression.ThreadLocalCompressionProvider
A ThreadLocal-based compression provider that either uses Velocity's native compression
or falls back to Java's built-in compression (Deflater/Inflater).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeflate(io.netty.buffer.ByteBuf source, io.netty.buffer.ByteBuf destination) Compresses data from the source buffer into the destination buffer.static voidinflate(io.netty.buffer.ByteBuf source, io.netty.buffer.ByteBuf destination, int expectedSize) Decompresses data from the source buffer into the destination buffer.
-
Method Details
-
deflate
public static void deflate(io.netty.buffer.ByteBuf source, io.netty.buffer.ByteBuf destination) throws DataFormatException Compresses data from the source buffer into the destination buffer.- Parameters:
source- the source buffer containing uncompressed datadestination- the destination buffer to write compressed data to- Throws:
DataFormatException- if compression fails
-
inflate
public static void inflate(io.netty.buffer.ByteBuf source, io.netty.buffer.ByteBuf destination, int expectedSize) throws DataFormatException Decompresses data from the source buffer into the destination buffer.- Parameters:
source- the source buffer containing compressed datadestination- the destination buffer to write decompressed data toexpectedSize- the expected size of the decompressed data- Throws:
DataFormatException- if decompression fails
-