Agent System POND 1.2 (28.2.2002)

FIM.Util.WWW
Class ConvertHTMLCharFilterReader

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

public class ConvertHTMLCharFilterReader
extends FilterReader

Converts the special characters of HTML (  = " ", ä = "ä", ...) and types of " " (Only decimal specification allowed, hex will be ignored) to normal Java characters.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag

Field Summary
protected  String buffer
          The buffer of characters already read from the input stream but not yet returned.
protected static Hashtable specialChars
          A table containing all the special characters as keys and their associated cleartext as the value.
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
ConvertHTMLCharFilterReader(Reader in)
          Creates a new reader.
 
Method Summary
(package private) static void ()
           
protected  void convertSpecialChar()
          Converts special characters that might be at the beginning of the buffer.
 boolean markSupported()
          Tell whether this stream supports the mark() operation (this stream does not).
 int read()
          Read a single character.
 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

specialChars

protected static Hashtable specialChars
A table containing all the special characters as keys and their associated cleartext as the value. The value may be an empty string.

Currently initialized with the following characters:
" ", "ä", "ö", "ü", "Ä", "&Oml;", "Ü", "ß", "&", "<", ">", """


buffer

protected String buffer
The buffer of characters already read from the input stream but not yet returned.
Constructor Detail

ConvertHTMLCharFilterReader

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

static void ()

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
Read a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.
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

convertSpecialChar

protected void convertSpecialChar()
                           throws IOException
Converts special characters that might be at the beginning of the buffer. Limited to 10 characters, so the special char must be terminated then or it will not be converted (Should be enough).
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.