|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.databeans.io.XmlOutput
public class XmlOutput
Manages encoding of data bean objects to XML. Usage:
Writer writer = new FileWriter ("file.dbxml"); XmlOutput xmlOutput = new XmlOutput (); xmlOutput.write (writer, object); writer.close ();
Constructor Summary | |
---|---|
XmlOutput()
Constructor for XmlOutput. |
|
XmlOutput(org.jdom.output.Format format)
Constructor for XmlOutput. |
|
XmlOutput(String indent,
boolean addNewlines)
Constructor for XmlOutput. |
Method Summary | |
---|---|
org.jdom.Element |
createHeader()
Method createHeaderElement. |
void |
finished()
Signal encoding is finished. |
int |
getMajorVersion()
|
int |
getMinorVersion()
|
Object |
getProperty(Object name)
Get a custom property defined by setProperty(Object, Object) . |
boolean |
isMultiObject()
See setMultiObject(boolean) . |
static void |
registerGlobalTextEncoder(TextEncoder encoder)
Register a global TextEncoder. |
static void |
registerGlobalXmlEncoder(XmlEncoder encoder)
Register a global XmlEncoder. |
void |
registerTextEncoder(TextEncoder encoder)
Register a TextEncoder for this output object. |
void |
registerXmlEncoder(XmlEncoder encoder)
Register an XmlEncoder for this output object. |
void |
setMajorVersion(int majorVersion)
|
void |
setMinorVersion(int minorVersion)
|
void |
setMultiObject(boolean newValue)
If set to true (default = false), then multiple elements may be decoded by calling the decode () methods multiple times while sharing the same context. |
void |
setProperty(Object name,
Object value)
Define a custom property that will be accessible during this session via getProperty(Object) and
XmlEncodeContext.getProperty(Object) . |
void |
setVersion(int majorVersion,
int minorVersion)
|
org.jdom.Element |
write(Object object)
Encode an object to a JDOM element. |
org.jdom.Element |
write(OutputStream stream,
Object object)
Serialize an object to a stream with dbxml header. |
org.jdom.Element |
write(Writer stream,
Object object)
Serialize an object to a stream with dbxml header. |
org.jdom.Element |
write(Writer stream,
Object object,
boolean includeHeader)
Serialize an object to a stream. |
String |
writeToString(Object object)
Shortcut to encode an object into an XML string, |
String |
writeXml(org.jdom.Element root)
Write a JDOM element tree to string, |
void |
writeXml(Writer writer,
org.jdom.Element root)
Write a JDOM element tree to a stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlOutput()
write(Writer, Object)
to
serialize objects.
public XmlOutput(String indent, boolean addNewlines)
write(Writer, Object)
to
serialize objects.
indent
- The characters to use for indenting.addNewlines
- If true, align tags using newlines.XmlOutput(Format)
public XmlOutput(org.jdom.output.Format format)
write(Writer, Object)
to
serialize objects.
format
- The JDOM formatting options.Method Detail |
---|
public void setProperty(Object name, Object value)
getProperty(Object)
and
XmlEncodeContext.getProperty(Object)
.
public Object getProperty(Object name)
setProperty(Object, Object)
.
public boolean isMultiObject()
setMultiObject(boolean)
.
public void setMultiObject(boolean newValue)
IMPORTANT: If this option is enabled, it is up to the client to
call finished()
when the decode session is complete,
otherwise outstanding links may not be resolved.
public void finished()
public org.jdom.Element write(OutputStream stream, Object object) throws IOException
stream
- The stream to write to.object
- The object to serialize.
IOException
- if an error occurs writing to the stream.write(Writer,Object)
public org.jdom.Element write(Writer stream, Object object) throws IOException
stream
- The stream to write to.object
- The object to serialize.
IOException
- if an error occurs writing to the stream.write(Writer,Object,boolean)
public org.jdom.Element write(Writer stream, Object object, boolean includeHeader) throws IOException
write(Object)
to encode the object to a JDOM document and
writeXml(Writer, Element)
to write the document to the stream. The
header (if requested) is created with createHeader()
.
stream
- The stream to write to.object
- The object to serialize.includeHeader
- True if the DBXML header should be included.
IOException
- if an error occurs writing to the stream.write(Object)
public String writeXml(org.jdom.Element root) throws IOException
root
- The document root.
IOException
- if an error occurs writing element.writeXml(Writer, Element)
public void writeXml(Writer writer, org.jdom.Element root) throws IOException
writer
- The stream.root
- The document root.
IOException
- if an error occurs writing to the stream.write(Writer, Object)
public org.jdom.Element write(Object object)
object
- The object.
public String writeToString(Object object) throws IOException
IOException
public org.jdom.Element createHeader()
public void registerXmlEncoder(XmlEncoder encoder)
encoder
- The encoder.registerGlobalXmlEncoder(XmlEncoder)
public void registerTextEncoder(TextEncoder encoder)
encoder
- The encoder.registerGlobalTextEncoder(TextEncoder)
public static void registerGlobalXmlEncoder(XmlEncoder encoder)
encoder
- The encoder.registerGlobalXmlEncoder(XmlEncoder)
public static void registerGlobalTextEncoder(TextEncoder encoder)
encoder
- The encoder.registerTextEncoder(TextEncoder)
public int getMajorVersion()
public int getMinorVersion()
public void setMajorVersion(int majorVersion)
public void setMinorVersion(int minorVersion)
public void setVersion(int majorVersion, int minorVersion)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |