move code to src/test
* so that it compiles and tests pass * fix some additional snip references in getting started
This commit is contained in:
parent
413df8e0f4
commit
59f53e1a22
289 changed files with 45 additions and 45 deletions
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Copyright (C) 2015-2017 Lightbend Inc. <http://www.lightbend.com>
|
||||
*/
|
||||
package jdocs.ddata.protobuf;
|
||||
|
||||
import jdocs.ddata.TwoPhaseSet;
|
||||
|
||||
import akka.actor.ExtendedActorSystem;
|
||||
|
||||
public class TwoPhaseSetSerializerWithCompression extends TwoPhaseSetSerializer {
|
||||
public TwoPhaseSetSerializerWithCompression(ExtendedActorSystem system) {
|
||||
super(system);
|
||||
}
|
||||
|
||||
//#compression
|
||||
@Override
|
||||
public byte[] toBinary(Object obj) {
|
||||
if (obj instanceof TwoPhaseSet) {
|
||||
return compress(twoPhaseSetToProto((TwoPhaseSet) obj));
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Can't serialize object of type " + obj.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object fromBinaryJava(byte[] bytes, Class<?> manifest) {
|
||||
return twoPhaseSetFromBinary(decompress(bytes));
|
||||
}
|
||||
//#compression
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue