lava.io
Class HashCommentStripperReader
java.lang.Object
|
+--java.io.Reader
|
+--java.io.FilterReader
|
+--lava.io.LFilterReader
|
+--lava.io.HashCommentStripperReader
- public class HashCommentStripperReader
- extends LFilterReader
Strips hashmark comments from a Reader.
Details: A HashCommentStripperReader filters incoming data from a Reader so that hash-marked comments are automatically omitted from the stream. Comments begin with the first hash mark (#) and extend to the end of the line. The end of the line is considered to be the first vertical space character, as determined by lava.clib.Ctype.isvspace. Stripping can be disabled and reenabled on the fly.
- Since:
- 1998.10.01
- Version:
- 1998.10.01
|
Field Summary |
protected boolean |
stripping
Indicates whether stripping is currently enabled. |
| Fields inherited from class java.io.FilterReader |
in |
| Fields inherited from class java.io.Reader |
lock |
|
Constructor Summary |
HashCommentStripperReader(java.io.Reader reader)
Constructs a new instance that reads from the given Reader. |
|
Method Summary |
int |
read()
Reads a character from the comment-stripped stream. |
int |
read(char[] dest,
int off,
int len)
Reads a block of characters from the comment-stripped stream. |
void |
setStripping(boolean enabled)
|
| Methods inherited from class java.io.FilterReader |
close, mark, markSupported, ready, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stripping
protected boolean stripping
- Indicates whether stripping is currently enabled.
Details: stripping indicates whether this Reader is currently stripping hash comments. stripping is initially true.
- Since:
- 1998.10.01
HashCommentStripperReader
public HashCommentStripperReader(java.io.Reader reader)
- Constructs a new instance that reads from the given
Reader.
- Parameters:
reader - the reader- Since:
- 1998.10.01
setStripping
public void setStripping(boolean enabled)
read
public int read()
throws java.io.IOException
- Reads a character from the comment-stripped stream.
- Overrides:
read in class java.io.FilterReader
- Returns:
- the character
- Throws:
java.io.IOException - if an I/O error occurs- Since:
- 1998.10.01
read
public int read(char[] dest,
int off,
int len)
throws java.io.IOException
- Reads a block of characters from the comment-stripped stream.
- Overrides:
read in class java.io.FilterReader
- Parameters:
dest - the destination arrayoff - offset into destlen - number of characters to readthe - number of characters actually read- Throws:
java.io.IOException - if an I/O error occurs- Since:
- 1998.10.01