MarshallerFactory.newSerializeMarshallingStrategy(),
new MarshallerProviderImpl().newIdentityMarshallingStrategy() };
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MarshallerWriteContext outContext = new MarshallerWriteContext( baos, null, null, null,
new ObjectMarshallingStrategyStoreImpl(strats), true, true, null);
OutputMarshaller.writeWorkItem(outContext, workItem);
byteArray = baos.toByteArray();
}
// unmarshall/deserialize workItem
{
// Reverse the order of strategies
ObjectMarshallingStrategy[] newStrats
= new ObjectMarshallingStrategy[] {
new MarshallerProviderImpl().newIdentityMarshallingStrategy(),
MarshallerFactory.newSerializeMarshallingStrategy() };
ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
MarshallerReaderContext inContext = new MarshallerReaderContext( bais, null, null,
new ObjectMarshallingStrategyStoreImpl(newStrats), Collections.EMPTY_MAP, true, true, null);
workItem = InputMarshaller.readWorkItem(inContext);
}
// Check
checkWorkItem(workItem, input);