|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.javatest.util.XMLWriter
public class XMLWriter
A class to facilitate writing XML via a stream.
Constructor Summary | |
---|---|
XMLWriter(java.io.Writer out)
Create an XMLWriter object, using a default header. |
|
XMLWriter(java.io.Writer out,
I18NResourceBundle i18n)
Create an XMLWriter object, using a specified bundle for l0calizing messages. |
|
XMLWriter(java.io.Writer out,
java.lang.String docType)
Create an XMLWriter object, using a specified doctype header. |
|
XMLWriter(java.io.Writer out,
java.lang.String docType,
I18NResourceBundle i18n)
Create an XMLWriter object, using a specified doctype header and using a specified bundle for localizing messages. |
Method Summary | |
---|---|
void |
close()
Close the stream, and the underlying output stream. |
void |
endTag(java.lang.String tag)
Finish an XML tag. |
void |
flush()
Flush the stream, and the underlying output stream. |
void |
newLine()
Write a newline to the underlying output stream. |
void |
setI18NResourceBundle(I18NResourceBundle i18n)
Set the resource bundle to be used for localizing messages. |
void |
startTag(java.lang.String tag)
Start an XML tag. |
void |
write(I18NResourceBundle i18n,
java.lang.String key)
Write a localized message, using a specified resource bundle. |
void |
write(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
Write a localized message, using a specified resource bundle. |
void |
write(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
Write a localized message, using a specified resource bundle. |
void |
write(java.lang.String text)
Write body text, escaping it as necessary. |
void |
writeAttr(java.lang.String name,
java.lang.String value)
Write an attribute for a tag. |
void |
writeDate(java.util.Date date)
Write a formatted date. |
void |
writeDate(long millis)
Write a formatted date. |
void |
writeDate(java.lang.String tag,
java.util.Date date)
Write a formatted date surrounded by a markup tag. |
void |
writeDate(java.lang.String tag,
long millis)
Write a formatted date surrounded by a markup tag. |
void |
writeI18N(java.lang.String key)
Write a localized message, using the default resource bundle. |
void |
writeI18N(java.lang.String key,
java.lang.Object arg)
Write a localized message, using the default resource bundle. |
void |
writeI18N(java.lang.String key,
java.lang.Object[] args)
Write a localized message, using the default resource bundle. |
void |
writeLine(java.lang.String text)
Write a line of text, followed by a newline. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLWriter(java.io.Writer out) throws java.io.IOException
out
- a Writer to which to write the generated XML
java.io.IOException
- if there is a problem writing to the underlying streampublic XMLWriter(java.io.Writer out, java.lang.String docType) throws java.io.IOException
out
- a Writer to which to write the generated XMLdocType
- a string containing a doctype header for the XML to be generated
java.io.IOException
- if there is a problem writing to the underlying streampublic XMLWriter(java.io.Writer out, I18NResourceBundle i18n) throws java.io.IOException
out
- a Writer to which to write the generated XMLi18n
- a resource bundle to use to localize messages
java.io.IOException
- if there is a problem writing to the underlying streampublic XMLWriter(java.io.Writer out, java.lang.String docType, I18NResourceBundle i18n) throws java.io.IOException
out
- a Writer to which to write the generated XMLdocType
- a string containing a doctype header for the XML to be generatedi18n
- a resource bundle to use to localize messages
java.io.IOException
- if there is a problem writing to the underlying streamMethod Detail |
---|
public void setI18NResourceBundle(I18NResourceBundle i18n)
i18n
- the resource bundle to be used for localizing messagespublic void flush() throws java.io.IOException
java.io.IOException
- if there is a problem writing to the underlying streampublic void close() throws java.io.IOException
java.io.IOException
- if there is a problem closing the underlying streampublic void newLine() throws java.io.IOException
java.io.IOException
- if there is a problem closing the underlying streampublic void startTag(java.lang.String tag) throws java.io.IOException
tag
- the tag to be started
java.io.IOException
- if there is a problem closing the underlying streamwriteAttr(java.lang.String, java.lang.String)
,
write(java.lang.String)
,
endTag(java.lang.String)
public void endTag(java.lang.String tag) throws java.io.IOException
tag
- the tag to be closed.
java.io.IOException
- if there is a problem closing the underlying streampublic void writeAttr(java.lang.String name, java.lang.String value) throws java.io.IOException
name
- the name of the attribute to be writtenvalue
- the value of the attribute to be written
java.lang.IllegalStateException
- if the stream is not in a state to
write attributes -- e.g. if this call does not follow startTag or other
calls of writteAttr
java.io.IOException
- if there is a problem closing the underlying streampublic void writeLine(java.lang.String text) throws java.io.IOException
text
- the text to be written.
java.io.IOException
- if there is a problem closing the underlying streampublic void writeDate(long millis) throws java.io.IOException
millis
- date represented in milliseconds
java.io.IOException
- if a exception occurs during writingDate
public void writeDate(java.lang.String tag, long millis) throws java.io.IOException
tag
- tag to open and close before and after the date is insertedmillis
- date represented in milliseconds
java.io.IOException
- if a exception occurs during writingDate
public void writeDate(java.util.Date date) throws java.io.IOException
date
- the date to print
java.io.IOException
- if a exception occurs during writingpublic void writeDate(java.lang.String tag, java.util.Date date) throws java.io.IOException
tag
- tag to open and close before and after the date is inserteddate
- the date to print
java.io.IOException
- if a exception occurs during writingDate
public void write(java.lang.String text) throws java.io.IOException
text
- the text to be written
java.io.IOException
- if there is a problem closing the underlying streampublic void write(I18NResourceBundle i18n, java.lang.String key) throws java.io.IOException
i18n
- the resource bundle used to localize the messagekey
- the key for the message to be localized
java.io.IOException
- if there is a problem closing the underlying streampublic void write(I18NResourceBundle i18n, java.lang.String key, java.lang.Object arg) throws java.io.IOException
i18n
- the resource bundle used to localize the messagekey
- the key for the message to be localizedarg
- an argument to be formatted into the localized message
java.io.IOException
- if there is a problem closing the underlying streampublic void write(I18NResourceBundle i18n, java.lang.String key, java.lang.Object[] args) throws java.io.IOException
i18n
- the resource bundle used to localize the messagekey
- the key for the message to be localizedargs
- arguments to be formatted into the localized message
java.io.IOException
- if there is a problem closing the underlying streampublic void writeI18N(java.lang.String key) throws java.io.IOException
key
- the key for the message to be localized
java.io.IOException
- if there is a problem closing the underlying streampublic void writeI18N(java.lang.String key, java.lang.Object arg) throws java.io.IOException
key
- the key for the message to be localizedarg
- an argument to be formatted into the localized message
java.io.IOException
- if there is a problem closing the underlying streampublic void writeI18N(java.lang.String key, java.lang.Object[] args) throws java.io.IOException
key
- the key for the message to be localizedargs
- arguments to be formatted into the localized message
java.io.IOException
- if there is a problem closing the underlying stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |