Class OutputStreamRecord

All Implemented Interfaces:
AbstractMarshalRecord<CoreAbstractSession,CoreField,XMLMarshaller,NamespaceResolver>, MarshalRecord<CoreAbstractSession,CoreField,XMLMarshaller,NamespaceResolver>, XMLRecord<CoreAbstractSession>
Direct Known Subclasses:
FormattedOutputStreamRecord

public class OutputStreamRecord extends MarshalRecord<XMLMarshaller>

Use this type of MarshalRecord when the marshal target is an OutputStream and the XML should not be formatted with carriage returns or indenting. This type is only used if the encoding of the OutputStream is UTF-8

XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
OutputStreamRecord record = new OutputStreamRecord();
record.setOutputStream(myOutputStream);
xmlMarshaller.marshal(myObject, record);

If the marshal(OutputStream) and setFormattedOutput(false) method is called on XMLMarshaller and the encoding is UTF-8, then the OutputStream is automatically wrapped in an OutputStream.

XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
xmlMarshaller xmlMarshaller.setFormattedOutput(false);
xmlMarshaller.marshal(myObject, myOutputStream);

See Also: