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

com.github.ddth.commons.serialization.ISerDeser Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.github.ddth.commons.serialization;

/**
 * Serializer/Deserializer.
 * 
 * @author Thanh Nguyen 
 * @since 0.5.0
 */
public interface ISerDeser {
    /**
     * Serializes an object.
     * 
     * @return
     * @throws SerializationException
     */
    public byte[] toBytes(Object obj) throws SerializationException;

    /**
     * Serializes an object.
     * 
     * @param obj
     * @param classLoader
     * @return
     * @throws SerializationException
     */
    public byte[] toBytes(Object obj, ClassLoader classLoader) throws SerializationException;

    /**
     * Deserializes an object.
     * 
     * @param data
     * @param clazz
     * @return
     * @throws DeserializationException
     */
    public  T fromBytes(byte[] data, Class clazz) throws DeserializationException;

    /**
     * Deserializes an object.
     * 
     * @param data
     * @param clazz
     * @param classLoader
     * @return
     * @throws DeserializationException
     */
    public  T fromBytes(byte[] data, Class clazz, ClassLoader classLoader)
            throws DeserializationException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy