colesico.framework.rpc.rpcgear.kryo.KryoExchange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of colesico-rpc Show documentation
Show all versions of colesico-rpc Show documentation
Colesico framework Remote Procedure Call for Services
The newest version!
package colesico.framework.rpc.rpcgear.kryo;
import colesico.framework.http.HttpContext;
import colesico.framework.rpc.rpcgear.httpbase.HttpRpcExchange;
import javax.inject.Provider;
import javax.inject.Singleton;
import java.io.InputStream;
import java.io.OutputStream;
@Singleton
public class KryoExchange extends HttpRpcExchange {
private final KryoSerializer serializer;
public KryoExchange(Provider httpContextProv, KryoSerializer serializer) {
super(httpContextProv);
this.serializer = serializer;
}
@Override
protected void serialize(T obj, OutputStream os) {
serializer.serialize(obj, os);
}
@Override
protected T deserialize(InputStream is, Class type) {
return serializer.deserialize(is, type);
}
}