All Downloads are FREE. Search and download functionalities are using the official Maven repository.

colesico.framework.rpc.rpcgear.kryo.KryoExchange Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy