Class DirectDecompress
java.lang.Object
com.aayushatharva.brotli4j.decoder.DirectDecompress
Directly decompresses data using
Decoder.decompress(byte[])-
Method Summary
Modifier and TypeMethodDescriptionstatic DirectDecompressdecompress(byte[] compressedData) Initiate direct decompression of datastatic DirectDecompressdecompress(byte[] compressedData, int maxOutputSize) Initiate direct decompression of data, failing if the decompressed output would exceedmaxOutputSizebytes.byte[]Get decompressed data.io.netty.buffer.ByteBufGet decompressed data.Get the result of decompression.
-
Method Details
-
decompress
Initiate direct decompression of data- Parameters:
compressedData- Compressed data as Byte Array- Returns:
DirectDecompressInstance- Throws:
IOException- In case of some error during decompression
-
decompress
public static DirectDecompress decompress(byte[] compressedData, int maxOutputSize) throws IOException Initiate direct decompression of data, failing if the decompressed output would exceedmaxOutputSizebytes. Use to mitigate decompression bombs.- Parameters:
compressedData- Compressed data as Byte ArraymaxOutputSize- cap on total decompressed bytes;0for no cap- Returns:
DirectDecompressInstance- Throws:
IOException- If output exceedsmaxOutputSize, or other decoding error
-
getResultStatus
Get the result of decompression.- Returns:
DecoderJNI.Status
-
getDecompressedData
public byte[] getDecompressedData()Get decompressed data.- Returns:
bytearray if decompression was successful elsenull
-
getDecompressedDataByteBuf
public io.netty.buffer.ByteBuf getDecompressedDataByteBuf()Get decompressed data.- Returns:
ByteBufif decompression was successful elsenull
-