package com.sdyc.ndmp.protobuf.serializer; import org.xerial.snappy.Snappy; import java.io.IOException; /** *
* Created with IntelliJ IDEA. * User: lwj * Date: 2015/2/27 * Time: 10:48 * To change this template use File | Settings | File Templates. ** * @author lwj */ public class SnappySerializer extends CompressSerializer { public SnappySerializer() { } @Override public byte[] compress(byte[] bytes) { try { return Snappy.compress(bytes); } catch (IOException e) { throw new IllegalStateException(e); } } @Override public byte[] uncompress(byte[] bytes) { try { return Snappy.uncompress(bytes); } catch (IOException e) { throw new IllegalStateException(e); } } }