mirror of
https://github.com/xerial/snappy-java.git
synced 2025-07-21 13:04:28 +02:00
Enforce use of byte arryas for output/input of rawComrpress/UnCompress methods
This commit is contained in:
parent
0da6942aab
commit
508b24805a
@ -243,7 +243,7 @@ public class Snappy
|
|||||||
* @return byte size of the compressed data
|
* @return byte size of the compressed data
|
||||||
* @throws SnappyException
|
* @throws SnappyException
|
||||||
*/
|
*/
|
||||||
public static int rawCompress(Object input, int inputOffset, int inputLength, Object output, int outputOffset)
|
public static int rawCompress(Object input, int inputOffset, int inputLength, byte[] output, int outputOffset)
|
||||||
throws SnappyException {
|
throws SnappyException {
|
||||||
if (input == null || output == null)
|
if (input == null || output == null)
|
||||||
throw new NullPointerException("input or output is null");
|
throw new NullPointerException("input or output is null");
|
||||||
@ -315,7 +315,30 @@ public class Snappy
|
|||||||
return rawUncompress(input, inputOffset, inputLength, output, outputOffset);
|
return rawUncompress(input, inputOffset, inputLength, output, outputOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int rawUncompress(Object input, int inputOffset, int inputLength, Object output, int outputOffset)
|
/**
|
||||||
|
* Uncompress the content in the input buffer. The uncompressed data is
|
||||||
|
* written to the output buffer.
|
||||||
|
*
|
||||||
|
* Note that if you pass the wrong data or the range [inputOffset,
|
||||||
|
* inputOffset + inputLength) that cannot be uncompressed, your JVM might
|
||||||
|
* crash due to the access violation exception issued in the native code
|
||||||
|
* written in C++. To avoid this type of crash, use
|
||||||
|
* {@link #isValidCompressedBuffer(byte[], int, int)} first.
|
||||||
|
*
|
||||||
|
* @param input
|
||||||
|
* input byte array
|
||||||
|
* @param inputOffset
|
||||||
|
* byte offset
|
||||||
|
* @param inputLength
|
||||||
|
* byte length of the input data
|
||||||
|
* @param output
|
||||||
|
* output buffer, MUST be a primitive type array
|
||||||
|
* @param outputOffset
|
||||||
|
* byte offset
|
||||||
|
* @return the byte size of the uncompressed data
|
||||||
|
* @throws SnappyException
|
||||||
|
*/
|
||||||
|
public static int rawUncompress(byte[] input, int inputOffset, int inputLength, Object output, int outputOffset)
|
||||||
throws SnappyException {
|
throws SnappyException {
|
||||||
if (input == null || output == null)
|
if (input == null || output == null)
|
||||||
throw new NullPointerException("input or output is null");
|
throw new NullPointerException("input or output is null");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user