|
|
|
@ -93,43 +93,7 @@ public class KryoCodec implements Codec {
|
|
|
|
|
|
|
|
|
|
private final KryoPool kryoPool;
|
|
|
|
|
|
|
|
|
|
public KryoCodec() {
|
|
|
|
|
this(new KryoPoolImpl(Collections.<Class<?>>emptyList()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KryoCodec(List<Class<?>> classes) {
|
|
|
|
|
this(new KryoPoolImpl(classes));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public KryoCodec(KryoPool kryoPool) {
|
|
|
|
|
this.kryoPool = kryoPool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Decoder<Object> getMapValueDecoder() {
|
|
|
|
|
return getValueDecoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Encoder getMapValueEncoder() {
|
|
|
|
|
return getValueEncoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Decoder<Object> getMapKeyDecoder() {
|
|
|
|
|
return getValueDecoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Encoder getMapKeyEncoder() {
|
|
|
|
|
return getValueEncoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Decoder<Object> getValueDecoder() {
|
|
|
|
|
return new Decoder<Object>() {
|
|
|
|
|
|
|
|
|
|
private final Decoder<Object> decoder = new Decoder<Object>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Object decode(ByteBuf buf, State state) throws IOException {
|
|
|
|
|
Kryo kryo = null;
|
|
|
|
@ -148,11 +112,8 @@ public class KryoCodec implements Codec {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Encoder getValueEncoder() {
|
|
|
|
|
return new Encoder() {
|
|
|
|
|
private final Encoder encoder = new Encoder() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public byte[] encode(Object in) throws IOException {
|
|
|
|
@ -176,6 +137,48 @@ public class KryoCodec implements Codec {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public KryoCodec() {
|
|
|
|
|
this(new KryoPoolImpl(Collections.<Class<?>>emptyList()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KryoCodec(List<Class<?>> classes) {
|
|
|
|
|
this(new KryoPoolImpl(classes));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public KryoCodec(KryoPool kryoPool) {
|
|
|
|
|
this.kryoPool = kryoPool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Decoder<Object> getMapValueDecoder() {
|
|
|
|
|
return getValueDecoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Encoder getMapValueEncoder() {
|
|
|
|
|
return getValueEncoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Decoder<Object> getMapKeyDecoder() {
|
|
|
|
|
return getValueDecoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Encoder getMapKeyEncoder() {
|
|
|
|
|
return getValueEncoder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Decoder<Object> getValueDecoder() {
|
|
|
|
|
return decoder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Encoder getValueEncoder() {
|
|
|
|
|
return encoder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|