All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.graphics.html.HTMLReader

java.lang.Object
   |
   +----jp.kyasu.graphics.html.HTMLReader

public class HTMLReader
extends Object
implements SGMLParserListener, Serializable
The HTMLReader class implements the reader that reads the HTML document ('text/html') and renders it into the HTMLText object or HTMLReaderTarget object.

For example:

    URL url = null;
    try {
        url = new URL("http://ring.aist.go.jp/openlab/kyasu/");
    }
    catch (MalformedURLException e) { return; }
    HTMLReader htmlReader = new HTMLReader(new HTMLStyle());
    HTMLText htmlText = null;
    try {
        htmlText = htmlReader.readFrom(url);
    }
    catch (IOException e) { return; }
 

This class does not support the following tags:
TABLE, FORM, FRAME, APPLET,.etc.

Version:
22 Jun 1998
Author:
Kazuki YASUMATSU
See Also:
HTMLStyle, HTMLText, HTMLReaderTarget, DefaultHTMLReaderTarget

Constructor Index

 o HTMLReader(HTMLStyle)
Constructs a html reader with the specified html style.
 o HTMLReader(HTMLStyle, ActionListener)
Constructs a html reader with the specified html style and action listener for the link (A).

Method Index

 o cdataParsed(SGMLEvent)
Invoked when a cdata has been parsed.
 o endTagParsed(SGMLEvent)
Invoked when a end tag has been parsed.
 o interruptReading()
Interrupts the reading.
 o parsingFinished(SGMLEvent)
Invoked when a parsing has been finished.
 o read(URL, HTMLReaderTarget)
Reads the HTML document ('text/html') from the specified url and renders it into the HTMLReaderTarget object.
 o read(URL, Reader, HTMLReaderTarget)
Reads the HTML document ('text/html') from the specified reader with the url of the HTML document, and renders it into the HTMLReaderTarget object.
 o read(URL, String, HTMLReaderTarget)
Reads the HTML document ('text/html') from the specified url with the specified encoding, and renders it into the HTMLReaderTarget object.
 o readFrom(URL)
Reads the HTML document ('text/html') from the specified url and renders it into the HTMLText object.
 o readFrom(URL, Reader)
Reads the HTML document ('text/html') from the specified reader with the url of the HTML document, and renders it into the HTMLText object.
 o readFrom(URL, String)
Reads the HTML document ('text/html') from the specified url with the specified encoding, and renders it into the HTMLText object.
 o startTagParsed(SGMLEvent)
Invoked when a start tag has been parsed.

Constructors

 o HTMLReader
 public HTMLReader(HTMLStyle htmlStyle)
Constructs a html reader with the specified html style.

Parameters:
htmlStyle - the html style for the rendering.
 o HTMLReader
 public HTMLReader(HTMLStyle htmlStyle,
                   ActionListener linkActionListener)
Constructs a html reader with the specified html style and action listener for the link (A).

Parameters:
htmlStyle - the html style for the rendering.
linkActionListener - the action listener for the link (A). If null, the created HTMLText becomes non clickable.

Methods

 o readFrom
 public HTMLText readFrom(URL url) throws IOException
Reads the HTML document ('text/html') from the specified url and renders it into the HTMLText object.

Parameters:
url - the url.
Returns:
the rendered HTMLText object.
Throws: IOException
If an I/O error occurs or the content type of the url is not 'text/html'.
 o readFrom
 public HTMLText readFrom(URL url,
                          String encodingName) throws IOException
Reads the HTML document ('text/html') from the specified url with the specified encoding, and renders it into the HTMLText object.

Parameters:
url - the url.
encodingName - the encoding name for reading.
Returns:
the rendered HTMLText object.
Throws: IOException
If an I/O error occurs or the content type of the url is not 'text/html'.
 o readFrom
 public HTMLText readFrom(URL documentURL,
                          Reader reader) throws IOException
Reads the HTML document ('text/html') from the specified reader with the url of the HTML document, and renders it into the HTMLText object.

Parameters:
documentURL - the url of the HTML document.
reader - the reader containing the HTML document.
Returns:
the rendered HTMLText object.
Throws: IOException
If an I/O error occurs.
 o read
 public void read(URL url,
                  HTMLReaderTarget target) throws IOException
Reads the HTML document ('text/html') from the specified url and renders it into the HTMLReaderTarget object.

Parameters:
url - the url.
target - the HTMLReaderTarget into which to render.
Throws: IOException
If an I/O error occurs or the content type of the url is not 'text/html'.
 o read
 public void read(URL url,
                  String encodingName,
                  HTMLReaderTarget target) throws IOException
Reads the HTML document ('text/html') from the specified url with the specified encoding, and renders it into the HTMLReaderTarget object.

Parameters:
url - the url.
encodingName - the encoding name for reading.
target - the HTMLReaderTarget into which to render.
Throws: IOException
If an I/O error occurs or the content type of the url is not 'text/html'.
 o read
 public void read(URL documentURL,
                  Reader reader,
                  HTMLReaderTarget target) throws IOException
Reads the HTML document ('text/html') from the specified reader with the url of the HTML document, and renders it into the HTMLReaderTarget object.

Parameters:
documentURL - the url of the HTML document.
reader - the reader containing the HTML document.
target - the HTMLReaderTarget into which to render.
Throws: IOException
If an I/O error occurs.
 o interruptReading
 public synchronized void interruptReading()
Interrupts the reading. The reading will be interrupted and then the IOException will be raised to the reading thread.

 o startTagParsed
 public void startTagParsed(SGMLEvent e) throws IOException
Invoked when a start tag has been parsed.

See Also:
startTagParsed
 o endTagParsed
 public void endTagParsed(SGMLEvent e) throws IOException
Invoked when a end tag has been parsed.

See Also:
endTagParsed
 o cdataParsed
 public void cdataParsed(SGMLEvent e) throws IOException
Invoked when a cdata has been parsed.

See Also:
cdataParsed
 o parsingFinished
 public void parsingFinished(SGMLEvent e) throws IOException
Invoked when a parsing has been finished.

See Also:
parsingFinished

All Packages  Class Hierarchy  This Package  Previous  Next  Index