public class HTMLWriter extends AbstractWriter
NEWLINE
Constructor | Description |
---|---|
HTMLWriter |
Creates a new HTMLWriter. |
HTMLWriter |
Creates a new HTMLWriter. |
Modifier and Type | Method | Description |
---|---|---|
protected void |
closeOutUnwantedEmbeddedTags |
Searches the attribute set and for each tag that is stored in the tag vector. |
protected void |
comment |
Writes out comments. |
protected void |
emptyTag |
Writes out all empty elements (all tags that have no corresponding end tag). |
protected void |
endTag |
Writes out an end tag for the element. |
protected boolean |
isBlockTag |
Determines if the HTML.Tag associated with the element is a block tag. |
protected boolean |
matchNameAttribute |
Returns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter. |
protected void |
output |
This method is overridden to map any character entities, such as < to <. |
protected void |
selectContent |
Writes out the content of the SELECT form element. |
protected void |
startTag |
Writes out a start tag for the element. |
protected boolean |
synthesizedElement |
Returns true if the element is a synthesized element. |
protected void |
text |
Writes out text. |
protected void |
textAreaContent |
Writes out text that is contained in a TEXTAREA form element. |
void |
write() |
Iterates over the Element tree and controls the writing out of all the tags and its attributes. |
protected void |
writeAttributes |
Writes out the attribute set. |
protected void |
writeEmbeddedTags |
Searches for embedded tags in the AttributeSet and writes them out. |
protected void |
writeLineSeparator() |
Writes the line separator. |
protected void |
writeOption |
Writes out the content of the Option form element. |
decrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write
public HTMLWriter(Writer w, HTMLDocument doc)
w
- a Writerdoc
- an HTMLDocumentpublic HTMLWriter(Writer w, HTMLDocument doc, int pos, int len)
w
- a Writerdoc
- an HTMLDocumentpos
- the document location from which to fetch the contentlen
- the amount to write outpublic void write() throws IOException, BadLocationException
write
in class AbstractWriter
IOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.protected void writeAttributes(AttributeSet attr) throws IOException
writeAttributes
in class AbstractWriter
attr
- an AttributeSetIOException
- on any I/O errorprotected void emptyTag(Element elem) throws BadLocationException, IOException
elem
- an ElementIOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.protected boolean isBlockTag(AttributeSet attr)
attr
- an AttributeSetprotected void startTag(Element elem) throws IOException, BadLocationException
elem
- an ElementIOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.protected void textAreaContent(AttributeSet attr) throws BadLocationException, IOException
attr
- an AttributeSetIOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.protected void text(Element elem) throws BadLocationException, IOException
text
in class AbstractWriter
elem
- an ElementIOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.protected void selectContent(AttributeSet attr) throws IOException
attr
- the AttributeSet associated with the form elementIOException
- on any I/O errorprotected void writeOption(Option option) throws IOException
option
- an OptionIOException
- on any I/O errorprotected void endTag(Element elem) throws IOException
elem
- an ElementIOException
- on any I/O errorprotected void comment(Element elem) throws BadLocationException, IOException
elem
- an ElementIOException
- on any I/O errorBadLocationException
- if pos represents an invalid location within the document.protected boolean synthesizedElement(Element elem)
true
if the element is a synthesized element. Currently we are only testing for the p-implied tag.elem
- an elementtrue
if the element is a synthesized element.protected boolean matchNameAttribute(AttributeSet attr, HTML.Tag tag)
attr
- a set of attributestag
- an HTML tagtrue
if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.protected void writeEmbeddedTags(AttributeSet attr) throws IOException
attr
- a set of attributesIOException
- on any I/O errorprotected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException
attr
- a set of attributesIOException
- on any I/O errorprotected void writeLineSeparator() throws IOException
writeLineSeparator
in class AbstractWriter
IOException
- on any I/O errorprotected void output(char[] chars, int start, int length) throws IOException
super.output
will be invoked to write the content.output
in class AbstractWriter
chars
- characters to outputstart
- starting indexlength
- length of outputIOException
- on any I/O error
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/text/html/HTMLWriter.html