org.apache.xmlrpc
class XmlWriter extends OutputStreamWriter
ByteArrayInputStream
, it may be necessary to call
writer.flush()
before calling
buffer.toByteArray()
to get the data written to
your byte buffer.
See Also: Tim Bray's
Annotated XML Spec
Field Summary | |
---|---|
protected static String | AMPERSAND_ENTITY |
protected static Base64 | base64Codec |
protected static String | CLOSING_TAG_START |
DateTool | dateTool
Thread-safe wrapper for the DateFormat object used
to parse date/time values. |
static Properties | encodings
Mapping between Java encoding names and "real" names used in
XML prolog.
|
protected static String | GREATER_THAN_ENTITY |
boolean | hasWrittenProlog
Whether the XML prolog has been written. |
static String | ISO8859_1
Java's name for the ISO-8859-1 encoding. |
protected static String | LESS_THAN_ENTITY |
static char[] | PROLOG |
protected static String | PROLOG_END |
protected static String | PROLOG_START |
protected static String | SINGLE_TAG_END |
protected static TypeDecoder | typeDecoder
Class to delegate type decoding to. |
static String | UTF16
Java's name for the UTF-16 encoding. |
static String | UTF8
Java's name for the UTF-8 encoding. |
Constructor Summary | |
---|---|
XmlWriter(OutputStream out, String enc)
Creates a new instance.
|
Method Summary | |
---|---|
protected static String | canonicalizeEncoding(String javaEncoding)
Tranforms a Java encoding to the canonical XML form (if a
mapping is available).
|
protected void | chardata(String text)
Writes text as PCDATA .
|
protected void | emptyElement(String elem) |
protected void | endElement(String elem) |
static String | forceUnicode(String encoding) |
static boolean | isValidXMLChar(char c)
Section 2.2 of the XML spec describes which Unicode code points
are valid in XML:
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(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.
|
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(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 | writeCharacterReference(char c)
Writes characters like '\r' (0xd) as " ". |
void | writeObject(Object obj)
Writes the XML representation of a supported Java object type.
|
DateFormat
object used
to parse date/time values.See Also: Java character set names
Parameters: 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.
Throws: UnsupportedEncodingException Since unsupported encodings are internally converted to UTF-8, this should only be seen as the result of an internal error.
Deprecated: This method will not be visible in 2.0.
Tranforms a Java encoding to the canonical XML form (if a mapping is available).Parameters: javaEncoding The name of the encoding as known by Java.
Returns: The XML encoding (if a mapping is available); otherwise, the encoding as provided.
PCDATA
.
Parameters: text The data to write.
Throws: XmlRpcException Unsupported character data found. IOException Problem writing data.
Parameters: elem
Throws: IOException
Parameters: elem
Throws: IOException
Parameters: encoding A caller-specified encoding.
Returns: An Unicode encoding.
#x9 | #xA | #xD | [#x20-#xD7FF] |
[#xE000-#xFFFD] | [#x10000-#x10FFFF]
Code points outside this set must be entity encoded to be
represented in XML.
Parameters: c The character to inspect.
Returns: Whether the specified character is valid in XML.
Parameters: elem
Throws: IOException
OutputStreamWriter.write()
which assures that the
XML prolog is written before any other data.
See Also: java.io.OutputStreamWriter.write(char[], int, int)
OutputStreamWriter.write()
which assures that the
XML prolog is written before any other data.
See Also: java.io.OutputStreamWriter.write(char)
OutputStreamWriter.write()
which assures that the
XML prolog is written before any other data.
See Also: java.io.OutputStreamWriter.write(String, int, int)
Parameters: obj The Object
to write.
Throws: XmlRpcException Unsupported character data found. IOException Problem writing data. IllegalArgumentException If a null
parameter is passed to this method (not supported by the XML-RPC specification).