public class HTMLWriter extends AbstractWriter
This is a writer for HTMLDocuments.
NEWLINE public HTMLWriter(Writer w,
HTMLDocument doc) Creates a new HTMLWriter.
w - a Writerdoc - an HTMLDocumentpublic HTMLWriter(Writer w,
HTMLDocument doc,
int pos,
int len) Creates a new HTMLWriter.
w - a Writerdoc - an HTMLDocumentpos - the document location from which to fetch the contentlen - the amount to write outpublic void write()
throws IOException,
BadLocationException Iterates over the Element tree and controls the writing out of all the tags and its attributes.
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 Writes out the attribute set. Ignores all attributes with a key of type HTML.Tag, attributes with a key of type StyleConstants, and attributes with a key of type HTML.Attribute.ENDTAG.
writeAttributes in class AbstractWriter
attr - an AttributeSetIOException - on any I/O errorprotected void emptyTag(Element elem)
throws BadLocationException,
IOException Writes out all empty elements (all tags that have no corresponding end tag).
elem - an ElementIOException - on any I/O errorBadLocationException - if pos represents an invalid location within the document.protected boolean isBlockTag(AttributeSet attr)
Determines if the HTML.Tag associated with the element is a block tag.
attr - an AttributeSetprotected void startTag(Element elem)
throws IOException,
BadLocationException Writes out a start tag for the element. Ignores all synthesized elements.
elem - an ElementIOException - on any I/O errorBadLocationExceptionprotected void textAreaContent(AttributeSet attr)
throws BadLocationException,
IOException Writes out text that is contained in a TEXTAREA form element.
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 Writes out text. If a range is specified when the constructor is invoked, then only the appropriate range of text is written out.
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 Writes out the content of the SELECT form element.
attr - the AttributeSet associated with the form elementIOException - on any I/O errorprotected void writeOption(Option option)
throws IOException Writes out the content of the Option form element.
option - an OptionIOException - on any I/O errorprotected void endTag(Element elem)
throws IOException Writes out an end tag for the element.
elem - an ElementIOException - on any I/O errorprotected void comment(Element elem)
throws BadLocationException,
IOException Writes out comments.
elem - an ElementIOException - on any I/O errorBadLocationException - if pos represents an invalid location within the document.protected boolean synthesizedElement(Element elem)
Returns true if the element is a synthesized element. Currently we are only testing for the p-implied tag.
protected boolean matchNameAttribute(AttributeSet attr,
HTML.Tag tag) Returns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.
protected void writeEmbeddedTags(AttributeSet attr)
throws IOException Searches for embedded tags in the AttributeSet and writes them out. It also stores these tags in a vector so that when appropriate the corresponding end tags can be written out.
IOException - on any I/O errorprotected void closeOutUnwantedEmbeddedTags(AttributeSet attr)
throws IOException Searches the attribute set and for each tag that is stored in the tag vector. If the tag is not found, then the tag is removed from the vector and a corresponding end tag is written out.
IOException - on any I/O errorprotected void writeLineSeparator()
throws IOException Writes the line separator. This is overriden to make sure we don't replace the newline content in case it is outside normal ascii.
writeLineSeparator in class AbstractWriter
IOExceptionprotected void output(char[] chars,
int start,
int length)
throws IOException This method is overriden to map any character entities, such as < to <. super.output will be invoked to write the content.
output in class AbstractWriter
IOException
© 1993–2017, 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.