package org.lucci.madhoc.messaging;

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

public class TransferableSerializableObject extends TransferableByteArray
{
    public void setValueAsObject(Serializable o)
    {
        try
        {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            oos.writeObject(o);
            setValue(baos.toByteArray());
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
            throw new IllegalStateException();
        }
    }
}