Package com.telenav.tnt.benchmark.serialization

Source Code of com.telenav.tnt.benchmark.serialization.HessianSerializer

package com.telenav.tnt.benchmark.serialization;

import com.caucho.hessian.io.HessianInput;
import com.caucho.hessian.io.HessianOutput;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class HessianSerializer implements Serializer {

    public String getName() {
        return "Hessian";
    }

    public void serialize(Object data, OutputStream outputStream) throws IOException {
        HessianOutput hessionOutput = new HessianOutput(outputStream);

        hessionOutput.writeObject(data);
        hessionOutput.close();
    }

    public Object deserialize(Class clazz, InputStream inputStream) throws IOException {
        HessianInput hession2Input = new HessianInput(inputStream);

        Object result = hession2Input.readObject();
        hession2Input.close();
        return result;
    }
}
TOP

Related Classes of com.telenav.tnt.benchmark.serialization.HessianSerializer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.