Update LZ4Transcoder to match Compressed strategy factory type.

This commit is contained in:
Charles Allen 2015-08-28 19:19:48 -07:00
parent 10af233b37
commit 413c0d1c9e
1 changed files with 3 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import com.google.common.primitives.Ints;
import net.jpountz.lz4.LZ4Compressor; import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4Decompressor; import net.jpountz.lz4.LZ4Decompressor;
import net.jpountz.lz4.LZ4Factory; import net.jpountz.lz4.LZ4Factory;
import net.jpountz.lz4.LZ4FastDecompressor;
import net.spy.memcached.transcoders.SerializingTranscoder; import net.spy.memcached.transcoders.SerializingTranscoder;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -28,18 +29,16 @@ import java.nio.ByteBuffer;
public class LZ4Transcoder extends SerializingTranscoder public class LZ4Transcoder extends SerializingTranscoder
{ {
private final LZ4Factory lz4Factory; private final LZ4Factory lz4Factory = LZ4Factory.fastestInstance();
public LZ4Transcoder() public LZ4Transcoder()
{ {
super(); super();
lz4Factory = LZ4Factory.fastestJavaInstance();
} }
public LZ4Transcoder(int max) public LZ4Transcoder(int max)
{ {
super(max); super(max);
lz4Factory = LZ4Factory.fastestJavaInstance();
} }
@Override @Override
@ -67,7 +66,7 @@ public class LZ4Transcoder extends SerializingTranscoder
{ {
byte[] out = null; byte[] out = null;
if(in != null) { if(in != null) {
LZ4Decompressor decompressor = lz4Factory.decompressor(); LZ4FastDecompressor decompressor = lz4Factory.fastDecompressor();
int size = ByteBuffer.wrap(in).getInt(); int size = ByteBuffer.wrap(in).getInt();