Java Doc for XMLObjectWriter.java in  » Development » Javolution » javolution » xml » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » Javolution » javolution.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javolution.xml.XMLObjectWriter

XMLObjectWriter
public class XMLObjectWriter implements Reusable(Code)

This class takes an object and formats it to XML; the resulting XML can be deserialized using a XMLObjectReader .

When an object is formatted, the XMLFormat of the object's class as identified by the XMLBinding is used to write its XML representation.

Multiple objects can be written to the same XML output. For example:[code] XMLObjectWriter writer = XMLObjectWriter.newInstance(outputStream); while (true)) { Message message = ... writer.write(message, "Message", Message.class); } writer.close(); // Writer is recycled, the underlying stream is closed. [/code]


author:
   Jean-Marie Dautelle
version:
   4.0, September 4, 2006



Constructor Summary
public  XMLObjectWriter()
     Default constructor.

Method Summary
public  voidclose()
     Ends document writting, closes this writer and its underlying output then XMLObjectWriter.reset reset this Writer for potential reuse.
public  voidflush()
     Flushes the output stream of this writer (automatically done when XMLObjectWriter.close() closing ).
public  XMLStreamWritergetStreamWriter()
     Returns the stream writer used by this object writer (it can be used to write prolog, write namespaces, etc).
public static  XMLObjectWriternewInstance(OutputStream out)
     Returns a XML object writer (potentially recycled) having the specified output stream as output.
public static  XMLObjectWriternewInstance(OutputStream out, String encoding)
     Returns a XML object writer (potentially recycled) having the specified output stream/encoding as output.
public static  XMLObjectWriternewInstance(Writer out)
     Returns a XML object writer (potentially recycled) having the specified writer as output.
public  voidreset()
     Resets this object writer for reuse.
public  XMLObjectWritersetBinding(XMLBinding binding)
     Sets the XML binding to use with this object writer.
Parameters:
  binding - the XML binding to use.
public  XMLObjectWritersetIndentation(String indentation)
     Sets the indentation to be used by this writer (no indentation by default).
Parameters:
  indentation - the indentation string.
public  XMLObjectWritersetOutput(OutputStream out)
     Sets the output stream for this XML object writer.
Parameters:
  out - the output stream destination.
public  XMLObjectWritersetOutput(OutputStream out, String encoding)
     Sets the output stream and encoding for this XML object writer.
Parameters:
  out - the output stream destination.
Parameters:
  encoding - the stream encoding.
public  XMLObjectWritersetOutput(Writer out)
     Sets the output writer for this XML object writer.
Parameters:
  out - the writer destination.
public  XMLObjectWritersetReferenceResolver(XMLReferenceResolver referenceResolver)
     Sets the XML reference resolver to use with this object writer (the same reference resolver can be used accross multiple writers).
Parameters:
  referenceResolver - the XML reference resolver.
public  voidwrite(Object obj)
     Writes the specified object as an anonymous nested element of unknown type.
public  voidwrite(Object obj, String name)
     Writes the specified object as a named nested element of unknown type (null objects are ignored).
public  voidwrite(Object obj, String localName, String uri)
     Writes the specified object as a fully qualified nested element of unknown type (null objects are ignored).
public  voidwrite(Object obj, String name, Class cls)
     Writes the specified object as a named nested element of actual type known (null objects are ignored).
public  voidwrite(Object obj, String localName, String uri, Class cls)
     Writes the specified object as a fully qualified nested element of actual type known (null objects are ignored).


Constructor Detail
XMLObjectWriter
public XMLObjectWriter()(Code)
Default constructor.




Method Detail
close
public void close() throws XMLStreamException(Code)
Ends document writting, closes this writer and its underlying output then XMLObjectWriter.reset reset this Writer for potential reuse.



flush
public void flush() throws XMLStreamException(Code)
Flushes the output stream of this writer (automatically done when XMLObjectWriter.close() closing ).



getStreamWriter
public XMLStreamWriter getStreamWriter()(Code)
Returns the stream writer used by this object writer (it can be used to write prolog, write namespaces, etc). The stream writer is setup to automatically repair namespaces and to automatically output empty elements when a start element is immediately followed by matching end element. the stream writer.



newInstance
public static XMLObjectWriter newInstance(OutputStream out) throws XMLStreamException(Code)
Returns a XML object writer (potentially recycled) having the specified output stream as output.
Parameters:
  out - the output stream.



newInstance
public static XMLObjectWriter newInstance(OutputStream out, String encoding) throws XMLStreamException(Code)
Returns a XML object writer (potentially recycled) having the specified output stream/encoding as output.
Parameters:
  out - the output stream.
Parameters:
  encoding - the output stream encoding.



newInstance
public static XMLObjectWriter newInstance(Writer out) throws XMLStreamException(Code)
Returns a XML object writer (potentially recycled) having the specified writer as output.
Parameters:
  out - the writer output.



reset
public void reset()(Code)
Resets this object writer for reuse.



setBinding
public XMLObjectWriter setBinding(XMLBinding binding)(Code)
Sets the XML binding to use with this object writer.
Parameters:
  binding - the XML binding to use. this



setIndentation
public XMLObjectWriter setIndentation(String indentation)(Code)
Sets the indentation to be used by this writer (no indentation by default).
Parameters:
  indentation - the indentation string. this



setOutput
public XMLObjectWriter setOutput(OutputStream out) throws XMLStreamException(Code)
Sets the output stream for this XML object writer.
Parameters:
  out - the output stream destination. this
See Also:   XMLStreamWriterImpl.setOutput(OutputStream)



setOutput
public XMLObjectWriter setOutput(OutputStream out, String encoding) throws XMLStreamException(Code)
Sets the output stream and encoding for this XML object writer.
Parameters:
  out - the output stream destination.
Parameters:
  encoding - the stream encoding. this
See Also:   XMLStreamWriterImpl.setOutput(OutputStreamString)



setOutput
public XMLObjectWriter setOutput(Writer out) throws XMLStreamException(Code)
Sets the output writer for this XML object writer.
Parameters:
  out - the writer destination. this
See Also:   XMLStreamWriterImpl.setOutput(Writer)



setReferenceResolver
public XMLObjectWriter setReferenceResolver(XMLReferenceResolver referenceResolver)(Code)
Sets the XML reference resolver to use with this object writer (the same reference resolver can be used accross multiple writers).
Parameters:
  referenceResolver - the XML reference resolver. this



write
public void write(Object obj) throws XMLStreamException(Code)
Writes the specified object as an anonymous nested element of unknown type.
Parameters:
  obj - the object written as nested element or null.
See Also:   XMLFormat.OutputElement.add(Object)



write
public void write(Object obj, String name) throws XMLStreamException(Code)
Writes the specified object as a named nested element of unknown type (null objects are ignored). The nested XML element may contain a class attribute identifying the object type.
Parameters:
  obj - the object added as nested element or null.
Parameters:
  name - the name of the nested element.
See Also:   XMLFormat.OutputElement.add(ObjectString)



write
public void write(Object obj, String localName, String uri) throws XMLStreamException(Code)
Writes the specified object as a fully qualified nested element of unknown type (null objects are ignored). The nested XML element may contain a class attribute identifying the object type.
Parameters:
  obj - the object added as nested element or null.
Parameters:
  localName - the local name of the nested element.
Parameters:
  uri - the namespace URI of the nested element.
See Also:   XMLFormat.OutputElement.add(ObjectStringString)



write
public void write(Object obj, String name, Class cls) throws XMLStreamException(Code)
Writes the specified object as a named nested element of actual type known (null objects are ignored).
Parameters:
  obj - the object added as nested element or null.
Parameters:
  name - the name of the nested element.
Parameters:
  cls - the non-abstract class identifying the XML format to use.
See Also:   XMLFormat.OutputElement.add(ObjectStringClass)



write
public void write(Object obj, String localName, String uri, Class cls) throws XMLStreamException(Code)
Writes the specified object as a fully qualified nested element of actual type known (null objects are ignored).
Parameters:
  obj - the object added as nested element or null.
Parameters:
  localName - the local name of the nested element.
Parameters:
  uri - the namespace URI of the nested element.
Parameters:
  cls - the class identifying the XML format to use.
See Also:   XMLFormat.OutputElement.add(ObjectStringStringClass)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.