Agent System POND 1.2 (28.2.2002)

FIM.Util.WWW
Class StripTagFilterReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.FilterReader
              |
              +--FIM.Util.WWW.StripTagFilterReader

public class StripTagFilterReader
extends FilterReader

Strips all tags from the stream. This will remove everything between '<' and '>'.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag

Field Summary
protected  char inQuotes
          Single or double quote if we are currently within quotation marks within a tag, space otherwise.
protected  boolean inTag
          true if we are currently within a tag.
protected  int lastChar
          The last character returned
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
StripTagFilterReader(Reader in)
          Creates a new reader.
 
Method Summary
 boolean markSupported()
          Tell whether this stream supports the mark() operation (this stream does not).
 int read()
          Retrieves the next character which is not a tag or within one.
 int read(char[] cbuf, int off, int len)
          Read characters into an array.
 boolean ready()
          Tell whether this stream is ready to be read.
 long skip(long n)
          Skip characters.
 
Methods inherited from class java.io.FilterReader
close, mark, reset
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inTag

protected boolean inTag
true if we are currently within a tag.

inQuotes

protected char inQuotes
Single or double quote if we are currently within quotation marks within a tag, space otherwise.

lastChar

protected int lastChar
The last character returned
Constructor Detail

StripTagFilterReader

public StripTagFilterReader(Reader in)
Creates a new reader.
Parameters:
in - the reader to read from
Method Detail

markSupported

public boolean markSupported()
Tell whether this stream supports the mark() operation (this stream does not).
Overrides:
markSupported in class FilterReader
Returns:
always false

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Read characters into an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.
Overrides:
read in class FilterReader
Parameters:
cbuf - destination buffer
off - the offset in the buffer the first character will be written to
len - the number of characters to read
Returns:
the number of bytes read, or -1 if the end of the stream has been reached
Throws:
IOException - if an I/O error occurs

read

public int read()
         throws IOException
Retrieves the next character which is not a tag or within one. Suppresses everything between "<" and ">" and ignores these characters when within a quotation within a tag (e. g. would be ended at the second ">", while xxxx "a
Overrides:
read in class FilterReader
Returns:
the character read, as an integer in the range 0 to 16383 (0x00-0xffff), or -1 if the end of the stream has been reached
Throws:
IOException - if an I/O error occurs

ready

public boolean ready()
              throws IOException
Tell whether this stream is ready to be read.
Overrides:
ready in class FilterReader
Returns:
true if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
Throws:
IOException - if an I/O error occurs

skip

public long skip(long n)
          throws IOException
Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.
Overrides:
skip in class FilterReader
Parameters:
n - the number of characters to skip
Returns:
the number of characters actually skipped
Throws:
IOException - if an I/O error occurs

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.