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

com.payneteasy.loggingextensions.utils.SerializationUtils Maven / Gradle / Ivy

package com.payneteasy.loggingextensions.utils;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * @author rpuch
 */
public class SerializationUtils {
    public static byte[] serializeObjectToBytes(Object object) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(object);
        oos.close();
        return baos.toByteArray();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy