CompressSerializer.java 669 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.sdyc.ndmp.protobuf.serializer;
  2. /**
  3. * <pre>
  4. *
  5. * Created by IntelliJ IDEA.
  6. * User: zhenqin
  7. * Date: 15/2/27
  8. * Time: 10:58
  9. * To change this template use File | Settings | File Templates.
  10. *
  11. * </pre>
  12. *
  13. * @author zhenqin
  14. */
  15. public abstract class CompressSerializer implements Serializer<byte[]> {
  16. public CompressSerializer() {
  17. }
  18. @Override
  19. public byte[] serialize(byte[] bytes) {
  20. return compress(bytes);
  21. }
  22. @Override
  23. public byte[] deserialize(byte[] bytes) {
  24. return uncompress(bytes);
  25. }
  26. public abstract byte[] compress(byte[] bytes);
  27. public abstract byte[] uncompress(byte[] bytes);
  28. }