FIM.Util.WWW
Class CanonicalFilterReader
java.lang.Object
|
+--java.io.Reader
|
+--java.io.FilterReader
|
+--FIM.Util.WWW.CanonicalFilterReader
- public class CanonicalFilterReader
- extends FilterReader
Removes all whitespaces and spaces at the beginning of the stream and converts all
multiple space characters within the stream to a single space (2nd, 3rd, ... are suppressed).
- Version:
- 1.0, 1.7.2000
- Author:
- Michael Sonntag
Field Summary |
protected boolean |
atBeginning
Marks that we are at the beginning of the stream (The first "letter"-character was not yet encountered). |
protected int |
lastChar
The character we returned on the last read-request. |
Method Summary |
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. |
long |
skip(long n)
Skip characters. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
atBeginning
protected boolean atBeginning
- Marks that we are at the beginning of the stream (The first "letter"-character was not yet encountered).
lastChar
protected int lastChar
- The character we returned on the last read-request.
CanonicalFilterReader
public CanonicalFilterReader(Reader in)
- Creates a new reader.
- Parameters:
in
- the reader to read from
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 bufferoff
- the offset in the buffer the first character will be written tolen
- 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
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
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.