Change enum type from int to byte

This commit is contained in:
Ankit Gupta 2014-07-07 12:18:55 -07:00
parent e8c592c625
commit 4efca96bb3
3 changed files with 13 additions and 13 deletions

View File

@ -6,20 +6,20 @@
package org.rocksdb;
public enum CompressionType {
NO_COMPRESSION(0),
SNAPPY_COMPRESSION(1),
ZLIB_COMPRESSION(2),
BZLIB2_COMPRESSION(3),
LZ4_COMPRESSION(4),
LZ4HC_COMPRESSION(5);
NO_COMPRESSION((byte) 0),
SNAPPY_COMPRESSION((byte) 1),
ZLIB_COMPRESSION((byte) 2),
BZLIB2_COMPRESSION((byte) 3),
LZ4_COMPRESSION((byte) 4),
LZ4HC_COMPRESSION((byte) 5);
private final int value_;
private final byte value_;
private CompressionType(int value) {
private CompressionType(byte value) {
value_ = value;
}
public int getValue() {
public byte getValue() {
return value_;
}
}

View File

@ -1328,7 +1328,7 @@ public class Options extends RocksObject {
public CompressionType compressionType() {
return CompressionType.values()[compressionType(nativeHandle_)];
}
private native int compressionType(long handle);
private native byte compressionType(long handle);
/**
* Compress blocks using the specified compression algorithm. This
@ -1352,7 +1352,7 @@ public class Options extends RocksObject {
setCompressionType(nativeHandle_, compressionType.getValue());
return this;
}
private native void setCompressionType(long handle, int compressionType);
private native void setCompressionType(long handle, byte compressionType);
/**
* If true, place whole keys in the filter (not just prefixes).

View File

@ -941,7 +941,7 @@ void Java_org_rocksdb_Options_setBlockRestartInterval(
* Signature: (JI)V
*/
void Java_org_rocksdb_Options_setCompressionType(
JNIEnv* env, jobject jobj, jlong jhandle, jint compression) {
JNIEnv* env, jobject jobj, jlong jhandle, jbyte compression) {
reinterpret_cast<rocksdb::Options*>(jhandle)->compression =
static_cast<rocksdb::CompressionType>(compression);
}
@ -951,7 +951,7 @@ void Java_org_rocksdb_Options_setCompressionType(
* Method: compressionType
* Signature: (J)I
*/
jint Java_org_rocksdb_Options_compressionType(
jbyte Java_org_rocksdb_Options_compressionType(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::Options*>(jhandle)->compression;
}