use of org.fusesource.hawtbuf.ByteArrayOutputStream in project fabric8 by jboss-fuse.
the class WireFormatInfo method beforeMarshall.
public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
// Need to marshal the properties.
if (marshalledProperties == null && properties != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(baos);
MarshallingSupport.marshalPrimitiveMap(properties, os);
os.close();
marshalledProperties = baos.toBuffer();
}
}
use of org.fusesource.hawtbuf.ByteArrayOutputStream in project fabric8 by jboss-fuse.
the class ActiveMQObjectMessage method storeContent.
public void storeContent() {
Buffer bodyAsBytes = getContent();
if (bodyAsBytes == null && object != null) {
try {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
OutputStream os = bytesOut;
if (Settings.enable_compression()) {
compressed = true;
os = new DeflaterOutputStream(os);
}
DataOutputStream dataOut = new DataOutputStream(os);
ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
objOut.writeObject(object);
objOut.flush();
objOut.reset();
objOut.close();
setContent(bytesOut.toBuffer());
} catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage(), ioe);
}
}
}
Aggregations