Class LinkInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--java.io.BufferedInputStream
                    |
                    +--LinkInputStream

public class LinkInputStream
extends BufferedInputStream

This specialization of InputStream helps on the parsing of a HTML file and finds strings containing hyperlinks. The kinds of hyperlinks recognized right now are only those contained in tags like '< a href="link">'. Known bugs of the present version of this class are: -HTML comments are not ignored; -some links are not recognized when contained in long lines.

Author:
Ademar Aguiar
Version: v0.2

Constructor Summary
LinkInputStream(InputStream in)
          Constructs an object that uses the input stream passed as an argument.

Method Summary
 StringnextLink()
          Parses the next link from the input stream.

Methods inherited from class java.io.BufferedInputStream
read, read, skip, available, mark, reset, markSupported, close

Methods inherited from class java.io.FilterInputStream
read

Methods inherited from class java.lang.Object
getClass, hashCode, equals, toString, notify, notifyAll, wait, wait, wait

Constructor Detail

LinkInputStream

public LinkInputStream(InputStream in)
Constructs an object that uses the input stream passed as an argument.
Parameters:
in - - the InputStream to analyse and to split in tokens
Method Detail

nextLink

public String nextLink()
throws java.io.IOException
Parses the next link from the input stream. Typical clients of this class only need to give a InpuStream with contents in HTML and then sit in a loop calling nextLink to parse successive links until null is returned.
Returns: the next link found in the form of a string value, or null when no more links are found in the input
Throws:
IOException - - if an I/O error occurs.

Association Links

to Class java.io.StreamTokenizer

The tokenizer object is responsible for breaking the input in tokens and to classify them in terms of symbols, operators, words and numbers.