* @param ostream The object dump output stream.
* @param obj The object to write.
*/
protected void output(OutputStream ostream, Object obj) throws Exception
{
CharacterStreamMarshaller msh = (CharacterStreamMarshaller)Class.forName(m_sMarshallerClassName)
.getConstructor(new Class[]{Context.class})
.newInstance(new Object[]{m_context});
if (msh instanceof TextMarshaller)
{
((TextMarshaller)msh).setVersion(3);
}
if (m_bCompressed)
{
ostream = new GZIPOutputStream(new NoCloseOutputStream(ostream));
}
Writer writer = IOUtil.openBufferedWriter(ostream, XMLUtil.ENCODING);
msh.serialize(obj, writer);
writer.close();
}