Class Decoders
java.lang.Object
com.aayushatharva.brotli4j.decoder.Decoders
Multiple decoding methods using Netty Buffer.
Make sure to add it as dependency before using this class
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DirectDecompressdecompress(io.netty.buffer.ByteBuf compressed, io.netty.buffer.ByteBuf decompressed) Decodes the given data buffer.static DirectDecompressdecompress(io.netty.buffer.ByteBuf compressed, io.netty.buffer.ByteBuf decompressed, int maxOutputSize) Decodes the given data buffer, failing if decompressed output would exceedmaxOutputSizebytes.static DirectDecompressdecompress(ByteBuffer compressed, ByteBuffer decompressed) Decodes the given data buffer.
-
Constructor Details
-
Decoders
public Decoders()
-
-
Method Details
-
decompress
public static DirectDecompress decompress(ByteBuffer compressed, ByteBuffer decompressed) throws IOException Decodes the given data buffer.- Parameters:
compressed-ByteBuffersource - will be read in full (position == limit after this call).decompressed-ByteBufferdestination - compressed data will be filled in beginning at position, up to remaining bytes; position is updated- Returns:
DirectDecompressinstance - upon return, only the status code is still valid- Throws:
IOException- Thrown in case of error during decoding
-
decompress
public static DirectDecompress decompress(io.netty.buffer.ByteBuf compressed, io.netty.buffer.ByteBuf decompressed) throws IOException Decodes the given data buffer.- Parameters:
compressed-ByteBufsourcedecompressed-ByteBufdestination- Returns:
DirectDecompressinstance- Throws:
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 IOException Decodes the given data buffer, failing if decompressed output would exceedmaxOutputSizebytes. Use to mitigate decompression bombs.- Parameters:
compressed-ByteBufsourcedecompressed-ByteBufdestinationmaxOutputSize- cap on total decompressed bytes;0for no cap- Returns:
DirectDecompressinstance- Throws:
IOException- If output exceedsmaxOutputSize
-