public class HTMLWriter
extends java.lang.Object
implements java.io.Serializable
HTMLWriter class implements the writer that saves the
HTMLText object as a HTML document ('text/html').
For example:
HTMLText htmlText = ...;
HTMLWriter htmlWriter = new HTMLWriter(htmlText);
try {
htmlWriter.writeTo(new File("index.html"));
}
catch (IOException e) { return; }
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected java.io.File |
baseFile
The base file.
|
protected int |
bqLevel
The BLOCKQUOTE level.
|
protected ParagraphStyle |
currentParagraphStyle
The current paragraph style.
|
static java.lang.String |
GENERATOR
The constant for the GENERATOR attribure for the META tag.
|
protected HTMLStyle |
htmlStyle
The html style.
|
protected HTMLText |
htmlText
The html text to be saved.
|
protected boolean |
inPreFormatted
True if in the PRE.
|
protected java.util.Stack |
listStack
The stack for the list (UL, OL and DL) level.
|
protected static java.lang.String |
SYSTEM_LINE_SEPARATOR
The constant for the system line separator.
|
protected java.io.Writer |
writer
The target writer.
|
| コンストラクタと説明 |
|---|
HTMLWriter(HTMLText htmlText)
Constructs a html writer with the specified html text.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected void |
checkBlockquote(ParagraphStyle pStyle)
Checks the change of the level of the BLOCKQUOTE for the specified
paragraph style.
|
protected void |
checkList(java.lang.String tag,
int level)
Checks the change of the level of the lists (UL, OL and DL) for
the specified list tag name with the current list level.
|
protected java.lang.String |
getImageSource(java.io.File basepath,
java.io.File imagepath)
Returns the image source path relative to the base path from the path
of the image file.
|
protected void |
write(int c)
Writes the specified character into the writer.
|
protected void |
write(java.lang.String s)
Writes the specified string into the writer.
|
protected void |
writeAnchor(TextAttachment ta,
VAnchor anchor)
Writes the specified text attachment with the specified
VAnchor object as a A tag. |
protected void |
writeColor(java.awt.Color c)
Writes the specified color as a HTML color format (#RRGGBB).
|
protected void |
writeData(int begin,
int end,
Text text,
boolean firstData)
Writes the specified range of the specified text as a HTML data.
|
protected java.util.Vector |
writeFontTags(TextStyle baseStyle,
TextStyle textStyle)
Writes the HTML font tag with a difference of the specified current
text style from the specified base text style.
|
protected void |
writeFooter()
Writes the footer for the HTML.
|
protected void |
writeHeader()
Writes the HTML header.
|
protected void |
writeHex(int i)
Writes the specified integer as a hex value.
|
protected void |
writeHR(TextAttachment ta,
VHRBorder v)
Writes the specified text attachment with the specified
VHRBorder object as a HR tag. |
protected void |
writeHTML()
Writes the HTML body.
|
protected void |
writeIMG(TextAttachment ta,
Visualizable v)
Writes the specified text attachment with the specified
Visualizable object as a IMG tag. |
protected void |
writeln()
Writes the line separator into the writer.
|
protected void |
writeln(java.lang.String s)
Writes the specified string with the line separator into the writer.
|
protected void |
writeOVAL(TextAttachment ta,
java.awt.Color c,
VOval v)
Writes the specified text attachment with the specified
color and
VOval object as a OVAL tag. |
protected void |
writeParagraph(int begin,
int end,
Text text,
ParagraphStyle pStyle)
Writes the paragraph in the specified range of the specified text
as a HTML with the specified paragraph style.
|
protected void |
writeRECT(TextAttachment ta,
java.awt.Color c,
VRectangle v)
Writes the specified text attachment with the specified
color and
VRectangle object as a RECT tag. |
protected void |
writeText(int begin,
int end,
Text text,
TextStyle baseStyle)
Writes the specified range of the specified text as a HTML with
the specified base text style.
|
protected void |
writeTEXT(TextAttachment ta,
java.lang.String title,
VRichText v)
Writes the specified text attachment with the specified
title and
VRichText object as a TEXT tag. |
protected void |
writeTextAttachment(TextAttachment ta)
Writes the specified text attachment as a HTML data.
|
void |
writeTo(java.io.File file)
Writes the html document as a HTML document ('
text/html')
into the specified file. |
void |
writeTo(java.io.File file,
java.lang.String encodingName)
Writes the html document as a HTML document ('
text/html')
into the specified file with the specified encoding. |
void |
writeTo(java.io.File baseFile,
java.io.Writer writer)
Writes the html document as a HTML document ('
text/html')
into the specified writer with the base file. |
protected HTMLText htmlText
protected HTMLStyle htmlStyle
protected transient java.io.File baseFile
protected transient java.io.Writer writer
protected java.util.Stack listStack
protected int bqLevel
protected ParagraphStyle currentParagraphStyle
protected boolean inPreFormatted
public static final java.lang.String GENERATOR
protected static final java.lang.String SYSTEM_LINE_SEPARATOR
public HTMLWriter(HTMLText htmlText)
htmlText - the html text to be saved.public void writeTo(java.io.File file)
throws java.io.IOException
text/html')
into the specified file.file - the file to be saved into.java.io.IOException - If an I/O error occurs.public void writeTo(java.io.File file,
java.lang.String encodingName)
throws java.io.IOException
text/html')
into the specified file with the specified encoding.file - the file to be saved into.encodingName - the encoding name for writing.java.io.IOException - If an I/O error occurs.public void writeTo(java.io.File baseFile,
java.io.Writer writer)
throws java.io.IOException
text/html')
into the specified writer with the base file.baseFile - the base file. the src attribute of
the IMG tag are genarated as a
pathname relative to the baseFile.writer - the writer to be saved into.java.io.IOException - If an I/O error occurs.protected void writeHeader()
throws java.io.IOException
java.io.IOExceptionprotected void writeFooter()
throws java.io.IOException
java.io.IOExceptionprotected void writeHTML()
throws java.io.IOException
java.io.IOExceptionprotected void writeParagraph(int begin,
int end,
Text text,
ParagraphStyle pStyle)
throws java.io.IOException
begin - the beginning index of the paragraph, inclusive.end - the ending index of the paragraph, exclusive.text - the text.pStyle - the paragraph style of the paragraph.java.io.IOExceptionprotected void checkBlockquote(ParagraphStyle pStyle) throws java.io.IOException
java.io.IOExceptionprotected void checkList(java.lang.String tag,
int level)
throws java.io.IOException
java.io.IOExceptionprotected void writeText(int begin,
int end,
Text text,
TextStyle baseStyle)
throws java.io.IOException
begin - the beginning index of the text, inclusive.end - the ending index of the text, exclusive.text - the text.baseStyle - the base text style.java.io.IOExceptionprotected java.util.Vector writeFontTags(TextStyle baseStyle, TextStyle textStyle) throws java.io.IOException
baseStyle - the base text style.textStyle - the current text style.java.io.IOExceptionprotected void writeData(int begin,
int end,
Text text,
boolean firstData)
throws java.io.IOException
begin - the beginning index of the text, inclusive.end - the ending index of the text, exclusive.text - the text.firstData - true if the data written is a first data in the
paragraph.java.io.IOExceptionprotected void writeTextAttachment(TextAttachment ta) throws java.io.IOException
ta - the text attachment.java.io.IOExceptionprotected void writeAnchor(TextAttachment ta, VAnchor anchor) throws java.io.IOException
VAnchor object as a A tag.ta - the text attachment.anchor - the VAnchor object.java.io.IOExceptionprotected void writeHR(TextAttachment ta, VHRBorder v) throws java.io.IOException
VHRBorder object as a HR tag.ta - the text attachment.v - the VHRBorder object.java.io.IOExceptionprotected void writeIMG(TextAttachment ta, Visualizable v) throws java.io.IOException
Visualizable object as a IMG tag.ta - the text attachment.v - the Visualizable object that should be a
VImage object, V3DBorder object or
VText object.java.io.IOExceptionprotected void writeTEXT(TextAttachment ta, java.lang.String title, VRichText v) throws java.io.IOException
VRichText object as a TEXT tag.
the TEXT tag is a extension tag and it is not defined in HTML 3.2.
ta - the text attachment.title - the title string.v - the VRichText object.java.io.IOExceptionprotected void writeOVAL(TextAttachment ta, java.awt.Color c, VOval v) throws java.io.IOException
VOval object as a OVAL tag.
the OVAL tag is a extension tag and it is not defined in HTML 3.2.
ta - the text attachment.c - the color.v - the VOval object.java.io.IOExceptionprotected void writeRECT(TextAttachment ta, java.awt.Color c, VRectangle v) throws java.io.IOException
VRectangle object as a RECT tag.
the RECT tag is a extension tag and it is not defined in HTML 3.2.
ta - the text attachment.c - the color.v - the VRectangle object.java.io.IOExceptionprotected void writeColor(java.awt.Color c)
throws java.io.IOException
java.io.IOExceptionprotected void writeHex(int i)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getImageSource(java.io.File basepath,
java.io.File imagepath)
basepath - the base path.imagepath - the pathname of the image file.protected void write(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionprotected void write(int c)
throws java.io.IOException
java.io.IOExceptionprotected void writeln()
throws java.io.IOException
java.io.IOExceptionprotected void writeln(java.lang.String s)
throws java.io.IOException
java.io.IOException