Package Summary  Overview Summary

class:HTMLWriter [NONE]


public class HTMLWriterextends AbstractWriter
This is a writer for HTMLDocuments.

constructor:HTMLWriter(java.io.Writer,javax.swing.text.html.HTMLDocument) [NONE]

  • HTMLWriter

    public HTMLWriter (Writer w, HTMLDocument doc)
    Creates a new HTMLWriter.
    Parameters:
    w - a Writer
    doc - an HTMLDocument
  • constructor:HTMLWriter(java.io.Writer,javax.swing.text.html.HTMLDocument,int,int) [NONE]

    HTMLWriter

    public HTMLWriter (Writer w, HTMLDocument doc, int pos, int len)
    Creates a new HTMLWriter.
    Parameters:
    w - a Writer
    doc - an HTMLDocument
    pos - the document location from which to fetch the content
    len - the amount to write out

    method:write() [NONE]

  • write

    public void write() throws IOException, BadLocationException
    Iterates over the Element tree and controls the writing out of all the tags and its attributes.
    Specified by:
    write in class AbstractWriter
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.
  • method:writeAttributes(javax.swing.text.AttributeSet) [NONE]

    writeAttributes

    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.
    Overrides:
    writeAttributes in class AbstractWriter
    Parameters:
    attr - an AttributeSet
    Throws:
    IOException - on any I/O error

    method:emptyTag(javax.swing.text.Element) [NONE]

    emptyTag

    protected void emptyTag (Element elem) throws BadLocationException, IOException
    Writes out all empty elements (all tags that have no corresponding end tag).
    Parameters:
    elem - an Element
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:isBlockTag(javax.swing.text.AttributeSet) [NONE]

    isBlockTag

    protected boolean isBlockTag (AttributeSet attr)
    Determines if the HTML.Tag associated with the element is a block tag.
    Parameters:
    attr - an AttributeSet
    Returns:
    true if tag is block tag, false otherwise.

    method:startTag(javax.swing.text.Element) [NONE]

    startTag

    protected void startTag (Element elem) throws IOException, BadLocationException
    Writes out a start tag for the element. Ignores all synthesized elements.
    Parameters:
    elem - an Element
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:textAreaContent(javax.swing.text.AttributeSet) [NONE]

    textAreaContent

    protected void textAreaContent (AttributeSet attr) throws BadLocationException, IOException
    Writes out text that is contained in a TEXTAREA form element.
    Parameters:
    attr - an AttributeSet
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:text(javax.swing.text.Element) [NONE]

    text

    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.
    Overrides:
    text in class AbstractWriter
    Parameters:
    elem - an Element
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:selectContent(javax.swing.text.AttributeSet) [NONE]

    selectContent

    protected void selectContent (AttributeSet attr) throws IOException
    Writes out the content of the SELECT form element.
    Parameters:
    attr - the AttributeSet associated with the form element
    Throws:
    IOException - on any I/O error

    method:writeOption(javax.swing.text.html.Option) [NONE]

    writeOption

    protected void writeOption (Option option) throws IOException
    Writes out the content of the Option form element.
    Parameters:
    option - an Option
    Throws:
    IOException - on any I/O error

    method:endTag(javax.swing.text.Element) [NONE]

    endTag

    protected void endTag (Element elem) throws IOException
    Writes out an end tag for the element.
    Parameters:
    elem - an Element
    Throws:
    IOException - on any I/O error

    method:comment(javax.swing.text.Element) [NONE]

    comment

    protected void comment (Element elem) throws BadLocationException, IOException
    Writes out comments.
    Parameters:
    elem - an Element
    Throws:
    IOException - on any I/O error
    BadLocationException - if pos represents an invalid location within the document.

    method:synthesizedElement(javax.swing.text.Element) [NONE]

    synthesizedElement

    protected boolean synthesizedElement (Element elem)
    Returns true if the element is a synthesized element. Currently we are only testing for the p-implied tag.
    Parameters:
    elem - an element
    Returns:
    true if the element is a synthesized element.

    method:matchNameAttribute(javax.swing.text.AttributeSet,javax.swing.text.html.HTML.Tag) [NONE]

    matchNameAttribute

    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.
    Parameters:
    attr - a set of attributes
    tag - an HTML tag
    Returns:
    true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.

    method:writeEmbeddedTags(javax.swing.text.AttributeSet) [NONE]

    writeEmbeddedTags

    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.
    Parameters:
    attr - a set of attributes
    Throws:
    IOException - on any I/O error

    method:closeOutUnwantedEmbeddedTags(javax.swing.text.AttributeSet) [NONE]

    closeOutUnwantedEmbeddedTags

    protected 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.
    Parameters:
    attr - a set of attributes
    Throws:
    IOException - on any I/O error

    method:writeLineSeparator() [CHANGED]

    writeLineSeparator

    protected void writeLineSeparator() throws IOException
    Writes the line separator. This is overridenoverridden to make sure we don't replace the newline content in case it is outside normal ascii.
    Overrides:
    writeLineSeparator in class AbstractWriter
    Throws:
    IOException - on any I/O error
    Since:
    1.3

    writeLineSeparator

    protected 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.
    Overrides:
    writeLineSeparator in class AbstractWriter
    Throws:
    IOException - on any I/O error
    Since:
    1.3

    writeLineSeparator

    protected void writeLineSeparator() throws IOException
    Writes the line separator. This is overridden to make sure we don't replace the newline content in case it is outside normal ascii.
    Overrides:
    writeLineSeparator in class AbstractWriter
    Throws:
    IOException - on any I/O error
    Since:
    1.3

    method:output(char[],int,int) [CHANGED]

    output

    protected void output (char[] chars, int start, int length) throws IOException
    This method is overridenoverridden to map any character entities, such as < to &lt;. super.output will be invoked to write the content.
    Overrides:
    output in class AbstractWriter
    Parameters:
    chars - characters to output
    start - starting index
    length - length of output
    Throws:
    IOException - on any I/O error
    Since:
    1.3

    output

    protected void output (char[] chars, int start, int length) throws IOException
    This method is overriden to map any character entities, such as < to &lt;. super.output will be invoked to write the content.
    Overrides:
    output in class AbstractWriter
    Parameters:
    chars - characters to output
    start - starting index
    length - length of output
    Throws:
    IOException - on any I/O error
    Since:
    1.3

    output

    protected void output (char[] chars, int start, int length) throws IOException
    This method is overridden to map any character entities, such as < to &lt;. super.output will be invoked to write the content.
    Overrides:
    output in class AbstractWriter
    Parameters:
    chars - characters to output
    start - starting index
    length - length of output
    Throws:
    IOException - on any I/O error
    Since:
    1.3

    © 2023 Oracle Corporation and/or its affiliates