From 83ceaddc8583c5f63804764e1c5004580b5b054d Mon Sep 17 00:00:00 2001 From: Ashley Taylor Date: Mon, 11 Apr 2022 11:10:55 +1200 Subject: [PATCH] adding uncompressDoubleArray that takes offset and length --- 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 4d4faad6..0c2815f0 100755 --- a/src/main/java/org/xerial/snappy/Snappy.java +++ b/src/main/java/org/xerial/snappy/Snappy.java @@ -598,9 +598,24 @@ public static char[] uncompressCharArray(byte[] input, int offset, int length) 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; }