You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by zi...@apache.org on 2004/01/29 07:56:07 UTC
cvs commit: xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal MarshallerImpl.java UnmarshallerImpl.java
zieg 2004/01/28 22:56:07
Modified: v2/src/common/org/apache/xmlbeans/impl/common
LoadSaveUtils.java
v2/src/marshal/org/apache/xmlbeans/impl/marshal
MarshallerImpl.java UnmarshallerImpl.java
Log:
make JSR 173 stream factories static
Revision Changes Path
1.2 +1 -0 xml-xmlbeans/v2/src/common/org/apache/xmlbeans/impl/common/LoadSaveUtils.java
Index: LoadSaveUtils.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/common/org/apache/xmlbeans/impl/common/LoadSaveUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoadSaveUtils.java 14 Nov 2003 20:28:36 -0000 1.1
+++ LoadSaveUtils.java 29 Jan 2004 06:56:07 -0000 1.2
@@ -97,6 +97,7 @@
public static void xmlStreamReader2XmlText(XMLStreamReader xsr, OutputStream os)
throws XMLStreamException
{
+ //REVIEW (zieg): I think we can cache this factory
XMLStreamWriter xsw = XMLOutputFactory.newInstance().createXMLStreamWriter(os);
while (xsr.hasNext())
1.15 +4 -4 xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java
Index: MarshallerImpl.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MarshallerImpl.java 26 Jan 2004 03:34:36 -0000 1.14
+++ MarshallerImpl.java 29 Jan 2004 06:56:07 -0000 1.15
@@ -86,7 +86,7 @@
private final RuntimeTypeFactory runtimeTypeFactory;
//REVIEW: can this be static?
- private final XMLOutputFactory xmlOutputFactory =
+ private static final XMLOutputFactory XML_OUTPUT_FACTORY =
XMLOutputFactory.newInstance();
private static final String XML_VERSION = "1.0";
@@ -184,7 +184,7 @@
throws XmlException
{
try {
- XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(out);
+ XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
XMLStreamReader rdr = marshal(obj, writer.getNamespaceContext());
XmlReaderToWriter.writeAll(rdr, writer);
}
@@ -250,9 +250,9 @@
{
XMLStreamWriter writer;
if (encoding != null) {
- writer = xmlOutputFactory.createXMLStreamWriter(out, encoding);
+ writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out, encoding);
} else {
- writer = xmlOutputFactory.createXMLStreamWriter(out);
+ writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
}
return writer;
}
1.18 +4 -3 xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshallerImpl.java
Index: UnmarshallerImpl.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshallerImpl.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- UnmarshallerImpl.java 29 Jan 2004 03:48:28 -0000 1.17
+++ UnmarshallerImpl.java 29 Jan 2004 06:56:07 -0000 1.18
@@ -71,7 +71,8 @@
{
private final BindingLoader bindingLoader;
private final RuntimeBindingTypeTable typeTable;
- private final XMLInputFactory xmlInputFactory =
+
+ private static final XMLInputFactory XML_INPUT_FACTORY =
XMLInputFactory.newInstance();
public UnmarshallerImpl(BindingLoader loader,
@@ -112,7 +113,7 @@
try {
final XMLStreamReader reader =
- xmlInputFactory.createXMLStreamReader(doc);
+ XML_INPUT_FACTORY.createXMLStreamReader(doc);
return unmarshal(reader, options);
}
catch (XMLStreamException e) {
@@ -146,6 +147,6 @@
XMLInputFactory getXmlInputFactory()
{
- return xmlInputFactory;
+ return XML_INPUT_FACTORY;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org