wt.htmlutil
Class UrlAwareParser

java.lang.Object
  extended bywt.htmlutil.TextParser
      extended bywt.htmlutil.UrlAwareParser
Direct Known Subclasses:
UrlAwareTextFormatter, UrlLister, WWWTester

public abstract class UrlAwareParser
extends TextParser

Implements TextParser's parseWord() method to search a stream word by word for URLs. UrlAwareParser is itself an abstract class, however, since there is no obvious default behavior for how detection/non-detection of an URL should be handled. Hence the abstract handleUrl() and handleNotUrl() methods.


Field Summary
(package private) static String HTTP
          Deprecated.  
(package private) static String[] protocols
          Deprecated. An array of protocol strings that the parser should test for.
(package private) static String WWW
          Deprecated.  
 
Fields inherited from class wt.htmlutil.TextParser
 
Constructor Summary
UrlAwareParser(Reader in)
          Deprecated.  
UrlAwareParser(String in)
          Deprecated.  
 
Method Summary
private  int getFirstValidCharIndex(String word)
          Deprecated.  
private  int getLastValidCharIndex(String word)
          Deprecated.  
(package private)  void handleEof()
          Deprecated. Empty method.
(package private)  void handleEol(String eolChar)
          Deprecated. Empty method.
(package private) abstract  void handleNotUrl(String word)
          Deprecated. Called when a non-url is found.
(package private)  void handleNumber(double num)
          Deprecated.  
(package private) abstract  void handleUrl(String start, String url, String end, boolean isWWW)
          Deprecated. Called when a valid url is found.
(package private)  void handleWord(String word)
          Deprecated. Parses a word, calls handleUrl or handleNotUrl as appropriate.
(package private)  void parseWord(String word)
          Deprecated.  
 
Methods inherited from class wt.htmlutil.TextParser
handleDefault, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protocols

static final String[] protocols
Deprecated. 
An array of protocol strings that the parser should test for. This does not include "www", which is tested for separately.


WWW

static final String WWW
Deprecated. 
See Also:
Constant Field Values

HTTP

static final String HTTP
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

UrlAwareParser

public UrlAwareParser(Reader in)
Deprecated. 

UrlAwareParser

public UrlAwareParser(String in)
Deprecated. 
Method Detail

handleWord

void handleWord(String word)
          throws IOException
Deprecated. 
Parses a word, calls handleUrl or handleNotUrl as appropriate.

Specified by:
handleWord in class TextParser
Throws:
IOException

parseWord

void parseWord(String word)
         throws IOException
Deprecated. 
Throws:
IOException

handleEol

void handleEol(String eolChar)
         throws IOException
Deprecated. 
Empty method.

Specified by:
handleEol in class TextParser
Throws:
IOException

handleEof

void handleEof()
Deprecated. 
Empty method.

Specified by:
handleEof in class TextParser

handleNumber

void handleNumber(double num)
            throws IOException
Deprecated. 
Specified by:
handleNumber in class TextParser
Throws:
IOException

handleUrl

abstract void handleUrl(String start,
                        String url,
                        String end,
                        boolean isWWW)
                 throws IOException
Deprecated. 
Called when a valid url is found.

Parameters:
start - Any non-alphanumerics at the start of the token.
url - The url.
end - Any non-alphanumerics at the end of the token.
isWWW - A flag indicating the url has no protocol, but begins with "www.".
Throws:
IOException

handleNotUrl

abstract void handleNotUrl(String word)
                    throws IOException
Deprecated. 
Called when a non-url is found.

Throws:
IOException

getFirstValidCharIndex

private int getFirstValidCharIndex(String word)
Deprecated. 

getLastValidCharIndex

private int getLastValidCharIndex(String word)
Deprecated.