Class Decoders


  • public final class Decoders
    extends java.lang.Object
    Multiple decoding methods using Netty Buffer. Make sure to add it as dependency before using this class
    See Also:
    Netty Buffer
    • Constructor Summary

      Constructors 
      Constructor Description
      Decoders()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static DirectDecompress decompress​(io.netty.buffer.ByteBuf compressed, io.netty.buffer.ByteBuf decompressed)
      Decodes the given data buffer.
      static DirectDecompress decompress​(io.netty.buffer.ByteBuf compressed, io.netty.buffer.ByteBuf decompressed, int maxOutputSize)
      Decodes the given data buffer, failing if decompressed output would exceed maxOutputSize bytes.
      static DirectDecompress decompress​(java.nio.ByteBuffer compressed, java.nio.ByteBuffer decompressed)
      Decodes the given data buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Decoders

        public Decoders()
    • Method Detail

      • decompress

        public static DirectDecompress decompress​(java.nio.ByteBuffer compressed,
                                                  java.nio.ByteBuffer decompressed)
                                           throws java.io.IOException
        Decodes the given data buffer.
        Parameters:
        compressed - ByteBuffer source - will be read in full (position == limit after this call).
        decompressed - ByteBuffer destination - compressed data will be filled in beginning at position, up to remaining bytes; position is updated
        Returns:
        DirectDecompress instance - upon return, only the status code is still valid
        Throws:
        java.io.IOException - Thrown in case of error during decoding
      • decompress

        public static DirectDecompress decompress​(io.netty.buffer.ByteBuf compressed,
                                                  io.netty.buffer.ByteBuf decompressed)
                                           throws java.io.IOException
        Decodes the given data buffer.
        Parameters:
        compressed - ByteBuf source
        decompressed - ByteBuf destination
        Returns:
        DirectDecompress instance
        Throws:
        java.io.IOException - Thrown in case of error during encoding
      • decompress

        public static DirectDecompress decompress​(io.netty.buffer.ByteBuf compressed,
                                                  io.netty.buffer.ByteBuf decompressed,
                                                  int maxOutputSize)
                                           throws java.io.IOException
        Decodes the given data buffer, failing if decompressed output would exceed maxOutputSize bytes. Use to mitigate decompression bombs.
        Parameters:
        compressed - ByteBuf source
        decompressed - ByteBuf destination
        maxOutputSize - cap on total decompressed bytes; 0 for no cap
        Returns:
        DirectDecompress instance
        Throws:
        java.io.IOException - If output exceeds maxOutputSize