public static byte [ ] decompressSafe ( final byte [ ] src , int maxDecompressedSize ) { if ( src == null ) { throw new IllegalArgumentException ( "src must not be null." ) ; } if ( maxDecompressedSize <= 0 ) { throw new IllegalArgumentException ( "maxDecompressedSize must be larger than 0 but " + maxDecompressedSize ) ; } LZ4SafeDecompressor decompressor = factory . safeDecompressor ( ) ; return decompressor . decompress ( src , maxDecompressedSize ) ; }
When the exact decompressed size is unknown . Decompress data size cannot be larger then maxDecompressedSize