diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
commit | ce57ab760f69de6db452def7ffbf5b114a2d8694 (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java | |
parent | 50996fe55769882de3f410896032c887f0ff0d04 (diff) | |
download | gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.tar.gz |
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java')
-rw-r--r-- | libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java b/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java index 05b6d6c0f11..c8c651fb1af 100644 --- a/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java +++ b/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java @@ -42,6 +42,8 @@ import java.io.OutputStreamWriter; import java.io.Writer; import java.io.UnsupportedEncodingException; +import javax.xml.transform.Result; +import javax.xml.transform.stream.StreamResult; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; @@ -94,6 +96,22 @@ public class XMLOutputFactoryImpl } } + public XMLStreamWriter createXMLStreamWriter(Result result) + throws XMLStreamException + { + if (result instanceof StreamResult) + { + StreamResult sr = (StreamResult) result; + OutputStream out = sr.getOutputStream(); + if (out != null) + return createXMLStreamWriter(out); + Writer writer = sr.getWriter(); + if (writer != null) + return createXMLStreamWriter(writer); + } + throw new UnsupportedOperationException(); + } + public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException { @@ -116,10 +134,26 @@ public class XMLOutputFactoryImpl return new XMLEventWriterImpl(writer); } + public XMLEventWriter createXMLEventWriter(Result result) + throws XMLStreamException + { + if (result instanceof StreamResult) + { + StreamResult sr = (StreamResult) result; + OutputStream out = sr.getOutputStream(); + if (out != null) + return createXMLEventWriter(out); + Writer writer = sr.getWriter(); + if (writer != null) + return createXMLEventWriter(writer); + } + throw new UnsupportedOperationException(); + } + public void setProperty(String name, Object value) throws IllegalArgumentException { - if (IS_PREFIX_DEFAULTING.equals(name)) + if (IS_REPAIRING_NAMESPACES.equals(name)) prefixDefaulting = ((Boolean) value).booleanValue(); else throw new IllegalArgumentException(name); @@ -128,14 +162,14 @@ public class XMLOutputFactoryImpl public Object getProperty(String name) throws IllegalArgumentException { - if (IS_PREFIX_DEFAULTING.equals(name)) + if (IS_REPAIRING_NAMESPACES.equals(name)) return new Boolean(prefixDefaulting); throw new IllegalArgumentException(name); } public boolean isPropertySupported(String name) { - if (IS_PREFIX_DEFAULTING.equals(name)) + if (IS_REPAIRING_NAMESPACES.equals(name)) return true; return false; } |