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

com.clearspring.analytics.util.ExternalizableUtil Maven / Gradle / Ivy

package com.clearspring.analytics.util;

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

public class ExternalizableUtil {

    public static byte[] toBytes(Externalizable o) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(baos);
        o.writeExternal(out);
        out.flush();
        return baos.toByteArray();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy