Sharkysoft home

lava.io
Class LFilterReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.FilterReader
              |
              +--lava.io.LFilterReader
Direct Known Subclasses:
HashCommentStripperReader, MarkReader, UnixLineReader

public abstract class LFilterReader
extends java.io.FilterReader

Modified FilterReader.

Details: If you are tempted to use java.io.FilterReader, try this class instead. An LFilterReader is essentially a java.io.FilterReader, except that read(char[]) is final. Since all known read(char[]) implementations simply forward to read(char[],int,int) anyway, there is very little reason to override the former when the latter must be overridden as well. (It would be bad design to give the two reads different behavior.) Therefore, it is sufficient to override read(char[],int,int) in a subclass and continue allowing the superclass's implementation of read(char[]) to forward to the other read. Additionally, making read(char[]) final helps prevents unexpected polymorphic loops in poorly designed code.

Since:
1998 (<1998.11.11)
Version:
2000.01.29

Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
LFilterReader(java.io.Reader reader)
          Sets forwarding to Reader.
 
Method Summary
 int read(char[] dest)
          Reads characters.
 
Methods inherited from class java.io.FilterReader
close, mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LFilterReader

public LFilterReader(java.io.Reader reader)
Sets forwarding to Reader.

Details: This constructor sets the input source to reader. All input requested from this Reader will be taken from reader.

Parameters:
reader - the input source
Method Detail

read

public final int read(char[] dest)
               throws java.io.IOException
Reads characters.

Details: This implementation of read forwards to

read (dest, 0, dest . length).

See read(char[],int,int) for more information.

Overrides:
read in class java.io.Reader
Parameters:
dest - the destination array
Returns:
number of characters stored
Throws:
java.io.IOException - if an I/O error occurs

Sharkysoft home