Fixes #26. Add throws IOException to rawCompress
This commit is contained in:
parent
e1b593d6c2
commit
64c35c7081
src/main/java/org/xerial/snappy
|
@ -354,7 +354,7 @@ public class Snappy
|
|||
* the input byte size
|
||||
* @return compressed data
|
||||
*/
|
||||
public static byte[] rawCompress(Object data, int byteSize) {
|
||||
public static byte[] rawCompress(Object data, int byteSize) throws IOException {
|
||||
byte[] buf = new byte[Snappy.maxCompressedLength(byteSize)];
|
||||
int compressedByteSize = ((SnappyNativeAPI) impl).rawCompress(data, 0, byteSize, buf, 0);
|
||||
byte[] result = new byte[compressedByteSize];
|
||||
|
|
|
@ -15,6 +15,22 @@ extern "C" {
|
|||
JNIEXPORT jstring JNICALL Java_org_xerial_snappy_SnappyNative_nativeLibraryVersion
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_xerial_snappy_SnappyNative
|
||||
* Method: rawCompress
|
||||
* Signature: (JJJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_xerial_snappy_SnappyNative_rawCompress__JJJ
|
||||
(JNIEnv *, jobject, jlong, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_xerial_snappy_SnappyNative
|
||||
* Method: rawUncompress
|
||||
* Signature: (JJJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_xerial_snappy_SnappyNative_rawUncompress__JJJ
|
||||
(JNIEnv *, jobject, jlong, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_xerial_snappy_SnappyNative
|
||||
* Method: rawCompress
|
||||
|
@ -71,6 +87,14 @@ JNIEXPORT jint JNICALL Java_org_xerial_snappy_SnappyNative_uncompressedLength__L
|
|||
JNIEXPORT jint JNICALL Java_org_xerial_snappy_SnappyNative_uncompressedLength__Ljava_lang_Object_2II
|
||||
(JNIEnv *, jobject, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_xerial_snappy_SnappyNative
|
||||
* Method: uncompressedLength
|
||||
* Signature: (JJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_xerial_snappy_SnappyNative_uncompressedLength__JJ
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_xerial_snappy_SnappyNative
|
||||
* Method: isValidCompressedBuffer
|
||||
|
|
|
@ -54,7 +54,7 @@ public class SnappyNative implements SnappyNativeAPI
|
|||
public native int rawCompress(ByteBuffer input, int inputOffset, int inputLength, ByteBuffer compressed,
|
||||
int outputOffset) throws IOException;
|
||||
|
||||
public native int rawCompress(Object input, int inputOffset, int inputByteLength, Object output, int outputOffset);
|
||||
public native int rawCompress(Object input, int inputOffset, int inputByteLength, Object output, int outputOffset) throws IOException;
|
||||
|
||||
public native int rawUncompress(ByteBuffer compressed, int inputOffset, int inputLength, ByteBuffer uncompressed,
|
||||
int outputOffset) throws IOException;
|
||||
|
|
|
@ -51,7 +51,7 @@ public interface SnappyNativeAPI
|
|||
public int rawCompress(ByteBuffer input, int inputOffset, int inputLength, ByteBuffer compressed, int outputOffset)
|
||||
throws IOException;
|
||||
|
||||
public int rawCompress(Object input, int inputOffset, int inputByteLength, Object output, int outputOffset);
|
||||
public int rawCompress(Object input, int inputOffset, int inputByteLength, Object output, int outputOffset) throws IOException;
|
||||
|
||||
public int rawUncompress(ByteBuffer compressed, int inputOffset, int inputLength, ByteBuffer uncompressed,
|
||||
int outputOffset) throws IOException;
|
||||
|
|
Loading…
Reference in New Issue