Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding uncompressDoubleArray that takes offset and length #307

Merged
merged 1 commit into from Jan 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/main/java/org/xerial/snappy/Snappy.java
Expand Up @@ -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;
}

Expand Down