Search in sources :

Example 6 with OutputStreamByteOutput

use of org.jboss.marshalling.OutputStreamByteOutput in project wildfly by wildfly.

the class DatabaseTimerPersistence method serialize.

private String serialize(final Serializable serializable) {
    if (serializable == null) {
        return null;
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        final Marshaller marshaller = factory.createMarshaller(configuration);
        marshaller.start(new OutputStreamByteOutput(out));
        marshaller.writeObject(serializable);
        marshaller.finish();
        out.flush();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return Base64.getEncoder().encodeToString(out.toByteArray());
}
Also used : Marshaller(org.jboss.marshalling.Marshaller) OutputStreamByteOutput(org.jboss.marshalling.OutputStreamByteOutput) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Aggregations

Marshaller (org.jboss.marshalling.Marshaller)6 OutputStreamByteOutput (org.jboss.marshalling.OutputStreamByteOutput)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 IOException (java.io.IOException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 StartException (org.jboss.msc.service.StartException)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 PortableRemoteObject (javax.rmi.PortableRemoteObject)1 EJBComponent (org.jboss.as.ejb3.component.EJBComponent)1 EJBHomeLocator (org.jboss.ejb.client.EJBHomeLocator)1 EntityEJBLocator (org.jboss.ejb.client.EntityEJBLocator)1 StatefulEJBLocator (org.jboss.ejb.client.StatefulEJBLocator)1 StatelessEJBLocator (org.jboss.ejb.client.StatelessEJBLocator)1