Class ThreadLocalCompressionProvider

java.lang.Object
com.viaversion.viarewind.api.compression.ThreadLocalCompressionProvider

public final class ThreadLocalCompressionProvider extends Object
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 Type
    Method
    Description
    static void
    deflate(io.netty.buffer.ByteBuf source, io.netty.buffer.ByteBuf destination)
    Compresses data from the source buffer into the destination buffer.
    static void
    inflate(io.netty.buffer.ByteBuf source, io.netty.buffer.ByteBuf destination, int expectedSize)
    Decompresses data from the source buffer into the destination buffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 data
      destination - 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 data
      destination - the destination buffer to write decompressed data to
      expectedSize - the expected size of the decompressed data
      Throws:
      DataFormatException - if decompression fails