org.apache.xmlrpc
Class XmlWriter
OutputStreamWriter
org.apache.xmlrpc.XmlWriter
(package private) class XmlWriter
extends OutputStreamWriter
A XML writer intended for single-thread usage. If you feed it a
ByteArrayInputStream
, it may be necessary to call
writer.flush()
before calling
buffer.toByteArray()
to get the data written to
your byte buffer.
XmlWriter(OutputStream out, String enc) - Creates a new instance.
|
protected static String | canonicalizeEncoding(String javaEncoding) - This method will not be visible in 2.0.
|
protected void | chardata(String text) - Writes text as
PCDATA .
|
protected void | emptyElement(String elem)
|
protected void | endElement(String elem)
|
private static String | forceUnicode(String encoding)
|
private static boolean | isValidXMLChar(char c) - Section 2.2 of the XML spec describes which Unicode code points
are valid in XML:
#x9 | #xA | #xD | [#x20-#xD7FF] |
[#xE000-#xFFFD] | [#x10000-#x10FFFF]
Code points outside this set must be entity encoded to be
represented in XML.
|
protected static void | setTypeDecoder(TypeDecoder newTypeDecoder)
|
protected void | startElement(String elem)
|
void | write(String str, int off, int len) - A mostly pass-through implementation wrapping
OutputStreamWriter.write() which assures that the
XML prolog is written before any other data.
|
protected void | write(byte[] byteData) - This is used to write out the Base64 output...
|
void | write(char c) - A mostly pass-through implementation wrapping
OutputStreamWriter.write() which assures that the
XML prolog is written before any other data.
|
void | write(char[] cbuf, int off, int len) - A mostly pass-through implementation wrapping
OutputStreamWriter.write() which assures that the
XML prolog is written before any other data.
|
private void | writeCharacterReference(char c) - Writes characters like '\r' (0xd) as " ".
|
void | writeObject(Object obj) - Writes the XML representation of a supported Java object type.
|
AMPERSAND_ENTITY
protected static final String AMPERSAND_ENTITY
CLOSING_TAG_START
protected static final String CLOSING_TAG_START
GREATER_THAN_ENTITY
protected static final String GREATER_THAN_ENTITY
ISO8859_1
(package private) static final String ISO8859_1
Java's name for the ISO-8859-1 encoding.
LESS_THAN_ENTITY
protected static final String LESS_THAN_ENTITY
PROLOG
private static final char[] PROLOG
PROLOG_END
protected static final String PROLOG_END
PROLOG_START
protected static final String PROLOG_START
SINGLE_TAG_END
protected static final String SINGLE_TAG_END
UTF16
(package private) static final String UTF16
Java's name for the UTF-16 encoding.
UTF8
(package private) static final String UTF8
Java's name for the UTF-8 encoding.
base64Codec
protected static final Base64 base64Codec
dateTool
(package private) DateTool dateTool
Thread-safe wrapper for the DateFormat
object used
to parse date/time values.
encodings
private static Properties encodings
Mapping between Java encoding names and "real" names used in
XML prolog.
hasWrittenProlog
(package private) boolean hasWrittenProlog
Whether the XML prolog has been written.
typeDecoder
protected static TypeDecoder typeDecoder
Class to delegate type decoding to.
XmlWriter
public XmlWriter(OutputStream out,
String enc)
throws UnsupportedEncodingException
Creates a new instance.
out
- The stream to write output to.enc
- The encoding to using for outputing XML. Only UTF-8
and UTF-16 are supported. If another encoding is specified,
UTF-8 will be used instead for widest XML parser
interoperability.
canonicalizeEncoding
protected static String canonicalizeEncoding(String javaEncoding)
This method will not be visible in 2.0.
Tranforms a Java encoding to the canonical XML form (if a
mapping is available).
javaEncoding
- The name of the encoding as known by Java.
- The XML encoding (if a mapping is available);
otherwise, the encoding as provided.
chardata
protected void chardata(String text)
throws XmlRpcException,
IOException
Writes text as PCDATA
.
text
- The data to write.
emptyElement
protected void emptyElement(String elem)
throws IOException
endElement
protected void endElement(String elem)
throws IOException
forceUnicode
private static String forceUnicode(String encoding)
encoding
- A caller-specified encoding.
isValidXMLChar
private static final boolean isValidXMLChar(char c)
Section 2.2 of the XML spec describes which Unicode code points
are valid in XML:
#x9 | #xA | #xD | [#x20-#xD7FF] |
[#xE000-#xFFFD] | [#x10000-#x10FFFF]
Code points outside this set must be entity encoded to be
represented in XML.
c
- The character to inspect.
- Whether the specified character is valid in XML.
setTypeDecoder
protected static void setTypeDecoder(TypeDecoder newTypeDecoder)
startElement
protected void startElement(String elem)
throws IOException
write
public void write(String str,
int off,
int len)
throws IOException
A mostly pass-through implementation wrapping
OutputStreamWriter.write()
which assures that the
XML prolog is written before any other data.
java.io.OutputStreamWriter.write(String, int, int)
write
protected void write(byte[] byteData)
throws IOException
This is used to write out the Base64 output...
write
public void write(char c)
throws IOException
A mostly pass-through implementation wrapping
OutputStreamWriter.write()
which assures that the
XML prolog is written before any other data.
java.io.OutputStreamWriter.write(char)
write
public void write(char[] cbuf,
int off,
int len)
throws IOException
A mostly pass-through implementation wrapping
OutputStreamWriter.write()
which assures that the
XML prolog is written before any other data.
java.io.OutputStreamWriter.write(char[], int, int)
writeCharacterReference
private void writeCharacterReference(char c)
throws IOException
Writes characters like '\r' (0xd) as " ".
writeObject
public void writeObject(Object obj)
throws XmlRpcException,
IOException
Writes the XML representation of a supported Java object type.
obj
- The Object
to write.
Copyright B) 1999-2002 Apache Software Foundation. All Rights Reserved.