com.sun.javatest.util
public class HTMLWriter extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
A
The HTML "a" tag.
|
static java.lang.String |
ALIGN
The HTML "align" attribute.
|
static java.lang.String |
B
The HTML "b" tag.
|
static java.lang.String |
BODY
The HTML "body" tag.
|
static java.lang.String |
BORDER
The HTML "border" attribute.
|
static java.lang.String |
BR
The HTML "br" tag.
|
static java.lang.String |
CLASSID
The HTML "classid" attribute.
|
static java.lang.String |
CODE
The HTML "code" tag.
|
static java.lang.String |
COL
The HTML "col" attribute value.
|
static java.lang.String |
COLOR
The HTML "color" attribute.
|
static java.lang.String |
FONT
The HTML "font" tag.
|
static java.lang.String |
H1
The HTML "h1" tag.
|
static java.lang.String |
H2
The HTML "h2" tag.
|
static java.lang.String |
H3
The HTML "h3" tag.
|
static java.lang.String |
H4
The HTML "h4" tag.
|
static java.lang.String |
HEAD
The HTML "head" tag.
|
static java.lang.String |
HR
The HTML "hr" tag.
|
static java.lang.String |
HREF
The HTML "href" attribute.
|
static java.lang.String |
HTML
The HTML "html" tag.
|
static java.lang.String |
I
The HTML "i" tag.
|
static java.lang.String |
IMAGE
The HTML "image" tag.
|
static java.lang.String |
LEFT
The HTML "left" attribute value.
|
static java.lang.String |
LI
The HTML "li" tag.
|
static java.lang.String |
LINK
The HTML "link" tag.
|
static java.lang.String |
NAME
The HTML "name" attribute.
|
static java.lang.String |
OBJECT
The HTML "object" tag.
|
static java.lang.String |
P
The HTML "param" tag.
|
static java.lang.String |
PARAM
The HTML "p" tag.
|
static java.lang.String |
REL
The HTML "rel" attribute value.
|
static java.lang.String |
RIGHT
The HTML "right" attribute value.
|
static java.lang.String |
ROW
The HTML "row" attribute value.
|
static java.lang.String |
SCOPE
The HTML "scope" attribute.
|
static java.lang.String |
SMALL
The HTML "small" tag.
|
static java.lang.String |
SRC
The HTML "src" attribute.
|
static java.lang.String |
STYLE
The HTML "style" attribute.
|
static java.lang.String |
TABLE
The HTML "table" tag.
|
static java.lang.String |
TD
The HTML "td" tag.
|
static java.lang.String |
TH
The HTML "th" tag.
|
static java.lang.String |
TITLE
The HTML "title"attribute.
|
static java.lang.String |
TOP
The HTML "top" attribute value.
|
static java.lang.String |
TR
The HTML "tr" tag.
|
static java.lang.String |
TYPE
The HTML "type" attribute.
|
static java.lang.String |
UL
The HTML "ul" tag.
|
static java.lang.String |
VALIGN
The HTML "valign" attribute.
|
static java.lang.String |
VALUE
The HTML "value" attribute.
|
Constructor and Description |
---|
HTMLWriter(java.io.Writer out)
Create an HTMLWriter object, using a default doctype for HTML 3.2.
|
HTMLWriter(java.io.Writer out,
I18NResourceBundle i18n)
Create an HTMLWriter object, using a specified bundle for l0calizing messages.
|
HTMLWriter(java.io.Writer out,
java.lang.String docType)
Create an HTMLWriter object, using a specified doctype header.
|
HTMLWriter(java.io.Writer out,
java.lang.String docType,
I18NResourceBundle i18n)
Create an HTMLWriter object, using a specified doctype header and
using a specified bundle for localizing messages.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream, and the underlying output stream.
|
void |
endEmptyTag(java.lang.String tag)
Finish an empty element tag, such as a META, BASE or LINK tag.
|
void |
endTag(java.lang.String tag)
Finish an HTML 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 HTML 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,
int value)
Write an attribute for a tag.
|
void |
writeAttr(java.lang.String name,
java.lang.String value)
Write an attribute for a tag.
|
void |
writeEntity(java.lang.String entity)
Write a basic HTML entity, such as or { .
|
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 |
writeImage(java.lang.String imagePath)
Write an image tag, using a specified path for the image source attribute.
|
void |
writeImage(java.net.URL imageURL)
Write an image tag, using a specified path for the image source attribute.
|
void |
writeLine(java.lang.String text)
Write a line of text, followed by a newline.
|
void |
writeLink(java.io.File file)
Write a hypertext link.
|
void |
writeLink(java.io.File file,
java.lang.String body)
Write a hypertext link.
|
void |
writeLink(java.lang.String anchor,
java.lang.String body)
Write a hypertext link.
|
void |
writeLink(java.net.URL url,
java.lang.String body)
Write a hypertext link.
|
void |
writeLinkDestination(java.lang.String anchor,
java.lang.String body)
Write the destination marker for a hypertext link.
|
void |
writeParam(java.lang.String name,
java.lang.String value)
Write a parameter tag.
|
void |
writeStyleAttr(java.lang.String value)
Write a style attribute.
|
public static final java.lang.String A
public static final java.lang.String ALIGN
public static final java.lang.String B
public static final java.lang.String BODY
public static final java.lang.String BORDER
public static final java.lang.String BR
public static final java.lang.String CLASSID
public static final java.lang.String CODE
public static final java.lang.String COLOR
public static final java.lang.String COL
public static final java.lang.String FONT
public static final java.lang.String H1
public static final java.lang.String H2
public static final java.lang.String H3
public static final java.lang.String H4
public static final java.lang.String HEAD
public static final java.lang.String HREF
public static final java.lang.String HTML
public static final java.lang.String HR
public static final java.lang.String I
public static final java.lang.String IMAGE
public static final java.lang.String LEFT
public static final java.lang.String LI
public static final java.lang.String LINK
public static final java.lang.String NAME
public static final java.lang.String OBJECT
public static final java.lang.String PARAM
public static final java.lang.String P
public static final java.lang.String REL
public static final java.lang.String RIGHT
public static final java.lang.String ROW
public static final java.lang.String SMALL
public static final java.lang.String SRC
public static final java.lang.String SCOPE
public static final java.lang.String STYLE
public static final java.lang.String TABLE
public static final java.lang.String TD
public static final java.lang.String TITLE
public static final java.lang.String TH
public static final java.lang.String TOP
public static final java.lang.String TR
public static final java.lang.String TYPE
public static final java.lang.String UL
public static final java.lang.String VALIGN
public static final java.lang.String VALUE
public HTMLWriter(java.io.Writer out) throws java.io.IOException
out
- a Writer to which to write the generated HTMLjava.io.IOException
- if there is a problem writing to the underlying streampublic HTMLWriter(java.io.Writer out, java.lang.String docType) throws java.io.IOException
out
- a Writer to which to write the generated HTMLdocType
- a string containing a doctype header for the HTML to be generatedjava.io.IOException
- if there is a problem writing to the underlying streampublic HTMLWriter(java.io.Writer out, I18NResourceBundle i18n) throws java.io.IOException
out
- a Writer to which to write the generated HTMLi18n
- a resource bundle to use to localize messagesjava.io.IOException
- if there is a problem writing to the underlying streampublic HTMLWriter(java.io.Writer out, java.lang.String docType, I18NResourceBundle i18n) throws java.io.IOException
out
- a Writer to which to write the generated HTMLdocType
- a string containing a doctype header for the HTML to be generatedi18n
- a resource bundle to use to localize messagesjava.io.IOException
- if there is a problem writing to the underlying streampublic 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 writing to the underlying streampublic void startTag(java.lang.String tag) throws java.io.IOException
tag
- the tag to be startedjava.io.IOException
- if there is a problem writing to 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 writing to the underlying streampublic void endEmptyTag(java.lang.String tag) throws java.io.IOException
tag
- the tag which is being closed. this is only useful for
validation, it is not written outjava.lang.IllegalStateException
- if this call does not follow startTag
(stream is not currently inside a tag)java.io.IOException
- if there is a problem writing to 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 writtenjava.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 writteAttrjava.io.IOException
- if there is a problem writing to the underlying streampublic void writeAttr(java.lang.String name, int value) throws java.io.IOException
name
- the name of the attribute to be writtenvalue
- the value of the attribute to be writtenjava.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 writteAttrjava.io.IOException
- if there is a problem writing to 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 write(java.lang.String text) throws java.io.IOException
text
- the text to be written, may be null or zero length.java.io.IOException
- if there is a problem writing to the underlying streampublic void writeEntity(java.lang.String entity) throws java.io.IOException
entity
- the entity to writejava.io.IOException
- if there is a problem writing to the underlying streampublic void writeImage(java.lang.String imagePath) throws java.io.IOException
imagePath
- the path for the image sourcejava.io.IOException
- if there is a problem closing the underlying streampublic void writeImage(java.net.URL imageURL) throws java.io.IOException
imageURL
- the url for the image sourcejava.io.IOException
- if there is a problem closing the underlying streampublic void writeLink(java.lang.String anchor, java.lang.String body) throws java.io.IOException
anchor
- the target for the linkbody
- the body text for the linkjava.io.IOException
- if there is a problem closing the underlying streampublic void writeLink(java.io.File file, java.lang.String body) throws java.io.IOException
file
- the target for the linkbody
- the body text for the linkjava.io.IOException
- if there is a problem closing the underlying streampublic void writeLink(java.io.File file) throws java.io.IOException
file
- the target and body for the linkjava.io.IOException
- if there is a problem closing the underlying streampublic void writeLink(java.net.URL url, java.lang.String body) throws java.io.IOException
url
- the target for the linkbody
- the body text for the linkjava.io.IOException
- if there is a problem closing the underlying streampublic void writeLinkDestination(java.lang.String anchor, java.lang.String body) throws java.io.IOException
anchor
- the destination marker for hypertext linksbody
- the body text for the markerjava.io.IOException
- if there is a problem closing the underlying streampublic void writeParam(java.lang.String name, java.lang.String value) throws java.io.IOException
name
- the name of the parametervalue
- the value of the parameterjava.io.IOException
- if there is a problem closing the underlying streampublic void writeStyleAttr(java.lang.String value) throws java.io.IOException
value
- the value for the style attributejava.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 localizedjava.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 messagejava.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 messagejava.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 localizedjava.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 messagejava.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 messagejava.io.IOException
- if there is a problem closing the underlying streamCopyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.