/** * Get the uncompressed byte size of the given compressed input. This operation takes O(1) time. * * @param inputAddr compressed data address * @param len byte length of the input * @return uncompressed byte length of the given input * @throws IOException when failed to uncompress the given input. The error code is * {@link SnappyErrorCode#PARSING_ERROR} */ public static long uncompressedLength(long inputAddr, long len) throws IOException { return impl.uncompressedLength(inputAddr, len); }
/** * Get the uncompressed byte size of the given compressed input. This * operation takes O(1) time. * * @param input * @return uncompressed byte size of the the given input data * @throws IOException when failed to uncompress the given input. The error code is * {@link SnappyErrorCode#PARSING_ERROR} */ public static int uncompressedLength(byte[] input) throws IOException { return impl.uncompressedLength(input, 0, input.length); }
/** * Get the uncompressed byte size of the given compressed input. This * operation takes O(1) time. * * @param input * @param offset * @param length * @return uncompressed byte size of the the given input data * @throws IOException when failed to uncompress the given input. The error code is * {@link SnappyErrorCode#PARSING_ERROR} */ public static int uncompressedLength(byte[] input, int offset, int length) throws IOException { if (input == null) { throw new NullPointerException("input is null"); } return impl.uncompressedLength(input, offset, length); }
/** * Get the uncompressed byte size of the given compressed input. This * operation takes O(1) time. * * @param compressed input data [pos() ... limit()) * @return uncompressed byte length of the given input * @throws IOException when failed to uncompress the given input. The error code is * {@link SnappyErrorCode#PARSING_ERROR} * @throws SnappyError when the input is not a direct buffer */ public static int uncompressedLength(ByteBuffer compressed) throws IOException { if (!compressed.isDirect()) { throw new SnappyError(SnappyErrorCode.NOT_A_DIRECT_BUFFER, "input is not a direct buffer"); } return impl.uncompressedLength(compressed, compressed.position(), compressed.remaining()); }