Represents a filter that filters the unselected text from an HTML stream.
netscape.plugin.composer.io package
java.io.Reader
Use this stream to speed up applications that only operate on selected text.
This table summarizes SelectedHTMLReader class methods:
Constructor | Description |
---|---|
SelectedHTMLReader( Reader) |
Creates an instance of the SelectedHTMLReader class that is used for read-only operations |
SelectedHTMLReader (Reader, Writer) |
Creates an instance of the SelectedHTMLReader class that is used for read-write operations |
Method | Description |
close() | Closes the input stream |
read() | Reads the input stream |
read(char[]) | Reads the input stream from a string buffer |
read(char[], int, int) |
Reads input stream of specified length from specified place in the string buffer |
skip(long) | Skips specified number of bytes |
Comment, Entity, JavaScriptEntity, LexicalStream, Tag, Text, Token, Reader
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Creates an instance of the SelectedHTMLReader class that is used for read-only operations.
SelectedHTMLReader class
public SelectedHTMLReader(Reader in) throws IOException
in |
Stream to read from |
This method creates a stream that is used for read-only operations. It calls the two-argument constructor with a null output stream.
The SelectedHTMLReader method filters the input Reader object. It copies all the unselected text of the document from the input Reader object to the output stream. Only the selected text is passed along to the consumer of the SelectedHTMLReader object.
IOException
The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Creates an instance of the SelectedHTMLReader class that is used for read-write operations.
SelectedHTMLReader class
public SelectedHTMLReader(Reader in, Writer out) throws IOException
in |
Stream to read from |
out |
Stream to write to. Can be null. |
This method creates a stream that is used for read-write operations. If the out parameter is supplied, all text outside of the HTML selection comments is automatically copied to the output stream.
Before the constructor returns, all the HTML text before the selection start comment is copied to the output stream.
IOException
The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Closes the input stream.
SelectedHTMLReader class
public void close() throws IOException
If an output stream was supplied to the constructor, any HTML text remaining in the input stream is flushed to the output stream. The output stream is not closed.
This function overrides the close function in the Reader class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Reads the input stream.
SelectedHTMLReader class
public int read() throws IOException
All three forms of the read() function were implemented for
the sake of completeness. For performance reasons, use read(char[],
int, int) when possible.
This function overrides the read function in the Reader class.
IOException
The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Reads the input stream from a string buffer.
SelectedHTMLReader class
public int read(char buf[]) throws IOException
buf[] |
Text of input steam to read |
All three forms of the read() function were implemented for
the sake of completeness. For performance reasons, use read(char[],
int, int) when possible.
This function overrides the read function in the Reader class.
IOException
The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Reads input stream of specified length from specified place in the string buffer.
SelectedHTMLReader class
public int read(char buf[], int start, int length) throws IOException
buf[] |
Text of input steam to read |
start |
Place in buffer to start reading (offset) |
length |
Length, in bytes, of data to read |
Use this form of the function in preference to the others where possible for performance reasons. All three forms of this function were implemented for the sake of completeness.
This function overrides the read function in the Reader class.
IOException
The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Skips specified number of bytes.
SelectedHTMLReader class
public long skip(long count) throws IOException
count |
Number of bytes to skip |
This function overrides the skip function in the Reader class.
IOException
The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Represents an HTML tag.
netscape.plugin.composer.io package
netscape.plugin.composer.io.Token
An HTML tag has a name, an open or close property, and zero or more attributes.
An HTML tag's attribute has a name and a value. If the value is the empty string, the attribute is printed as NAME; otherwise it is printed as NAME=VALUE.
This table summarizes Tag class methods:
Constructor | Description |
---|---|
Tag(String) | Creates an open instance of the Tag class |
Tag(String, boolean) |
Creates an instance of the Tag class |
Methods | Description |
addAttribute( String, String) |
Adds an attribute name and value pair to the tag |
clearAttributes() | Clears the existing attributes |
clone() | Clones the tag |
containsAttribute( String) |
Tests whether this tag has a particular attribute |
equals(Object) | Performs an equality test |
getAttributes() | Gets an enumeration of the attributes of the current tag |
getName() | Gets the name of a tag |
hasAttributes() | Tests whether tag has attributes |
hashCode() | Computes a hash code |
isClose() | Gets the open/close state of the tag |
isOpen() | Gets the open/close state of the tag |
lookupAttribute(String) | Looks up the value associated with a given tag attribute |
removeAttribute(String) | Removes an attribute name and value pair from the tag |
toString() | Translates the Tag object into a string representation |
Comment, Entity, JavaScriptEntity, LexicalStream, SelectedHTMLReader, Text, Token, Reader
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Creates an open instance of the Tag class.
Tag class
public Tag(String name)
name |
Name of the tag; automatically converted to uppercase |
This method always creates a new open tag. To create closed tags, use the constructor that takes a second Boolean parameter.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Creates an instance of the Tag class.
Tag class
public Tag(String name, boolean open)
name |
Name of the tag. Automatically converted to upper case. |
open |
true if this is an open tag. |
This method creates a new tag.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Adds an attribute name and value pair to the tag.
Tag class
public String addAttribute(String name, String value)
name |
Name of the attribute; always converted to uppercase |
value |
Value of the attribute |
If the attribute already exists, addAttribute replaces and returns the old value.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Clears the existing attributes.
Tag class
public void clearAttributes()
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Clones the tag.
Tag class
public Object clone()
This function overrides the clone function in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Tests whether this tag has a particular attribute.
Tag class
public boolean containsAttribute(String name)
name |
Attribute you are searching for; must be in uppercase |
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Tests whether this tag equals another tag, including the name and the attributes.
Tag class
public boolean equals(Object other)
other |
Tag to test for equality |
This function overrides the equals function in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Gets an enumeration of the attributes of the current tag.
Tag class
public Enumeration getAttributes()
An enumeration of the attributes of this tag.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Gets the name of a tag.
Tag class
public String getName()
Name of the tag, always in uppercase.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Tests whether a tag has attributes.
Tag class
public boolean hasAttributes()
An iterator over the attributes.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Computes a hash code.
Tag class
public int hashCode()
The hash code for the tag.
This function overrides the hashCode function in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Gets the open/close state of the tag.
Tag class
public boolean isClose()
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Gets the open/close state of the tag.
Tag class
public boolean isOpen()
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Looks up the value associated with a given tag attribute.
Tag class
public String lookupAttribute(String name)
name |
Name of the attribute; must be in uppercase |
The value of the attribute or null if the attribute does not exist.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Removes an attribute name and value pair from the tag.
Tag class
public String removeAttribute(String name)
name |
Name of the attribute; must be in uppercase |
The value of the attribute, or null if the attribute was not part of the tag.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Translates the Tag object into a string representation.
Tag class
public String toString()
The HTML string representation of the tag
This function overrides the toString function in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Represents a token for the text of an HTML document.
netscape.plugin.composer.io package
netscape.plugin.composer.io.Token
This class extends Token, which is the base class for HTML tokens.
The HTML document contains text at its lowest level. The Text class represents a token for the text of an HTML document. Plug-ins can process text as Text class objects or as a set of HTML Token class objects. The approach you use depends upon the type of editing the plug-in needs to do. In most cases, tokens are more useful because they contain more information than text units and so make the developer's job easier.
This table summarizes Text class methods:
Constructor | Description |
---|---|
Text(String) | Creates an instance of the Text class from a given string |
Methods | Description |
equals(Object) | Performs an equality test |
getText() | Copies the text to the document |
hashCode() | Calculates the hash code for this object |
isNewline() | Checks for a newline character |
setText(String) | Places the text in the dialog box |
toString() | Converts the text to its HTML representation |
Comment, Entity, JavaScriptEntity, LexicalStream, SelectedHTMLReader, Tag, Token, Reader
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Creates an instance of the Text class from a given string.
Text class
public Text(String text)
text |
Text content of string |
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Checks for equality.
Text class
public boolean equals(Object other)
other |
Text to test for equality |
This function overrides equals in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Copies the text in the dialog box to the document.
Text class
public String getText()
text |
Text to get from the dialog box |
This function copies the text in the dialog box and places that text in the document.
The copied text.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Calculates the hash code for this object.
Text class
public int hashCode()
The hash code for this object.
This function overrides hashCode in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Checks whether the text is a solitary newline character.
Text class
public boolean isNewline()
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Places the text in a dialog box.
Text class
public void setText(String text)
text |
Text to place in the dialog box. |
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Converts the text to its HTML representation.
Text class
public String toString()
The HTML representation of the text.
This function overrides toString in the Object class.
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Represents an HTML token.
netscape.plugin.composer.io package
java.lang.Object
The Token class is the base class for HTML tokens. This class has no protocol of its own beyond its inheritance from Object. The Token class implements the Cloneable interface, which allows token objects to be cloneable. To learn more about this class, look at the classes derived from it:
The HTML document contains text at its lowest level. Plug-ins can process text as Text class objects or as a set of HTML Token class objects. The approach you use depends upon the type of editing the plug-in needs to do. In most cases, tokens are more useful because they contain more information than text units and so make the developer's job easier.
The Colorize and DocInfo samples, included in the Composer Plug-in Kit, deal with tokens.
This table shows the Token class constructor, its only method:
Constructor | Description |
---|---|
Token() | Creates an instance of the Token class |
Comment, Entity, JavaScriptEntity, LexicalStream, SelectedHTMLReader, Tag, Text, Reader
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Creates an instance of the Token class.
Token class
public Token()
[Top] [IO Package Classes] [Composer Plug-in API Reference]
Copyright © 1997 Netscape Communications Corporation