From 34fa6e9e65557e565facbcbed819e07ea0d14d02 Mon Sep 17 00:00:00 2001 From: Ashley Taylor <7232476+ashley-taylor@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:06:45 +1300 Subject: [PATCH] Add uncompressDoubleArray that takes offset and length (#307) --- src/main/java/org/xerial/snappy/Snappy.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/xerial/snappy/Snappy.java b/src/main/java/org/xerial/snappy/Snappy.java index 4d4faad..0c2815f 100755 --- a/src/main/java/org/xerial/snappy/Snappy.java +++ b/src/main/java/org/xerial/snappy/Snappy.java @@ -598,9 +598,24 @@ public class Snappy public static double[] uncompressDoubleArray(byte[] input) throws IOException { - int uncompressedLength = Snappy.uncompressedLength(input, 0, input.length); + return uncompressDoubleArray(input, 0, input.length); + } + + /** + * Uncompress the input as a double array + * + * @param input + * @param offset + * @param length + * @return the uncompressed data + * @throws IOException + */ + public static double[] uncompressDoubleArray(byte[] input, int offset, int length) + throws IOException + { + int uncompressedLength = Snappy.uncompressedLength(input, offset, length); double[] result = new double[uncompressedLength / 8]; - impl.rawUncompress(input, 0, input.length, result, 0); + impl.rawUncompress(input, offset, length, result, 0); return result; }