FileDocCategorySizeDatePackage
ProxyReader.javaAPI DocAndroid 1.5 API4383Wed May 06 22:42:46 BST 2009org.apache.commons.io.input

ProxyReader

public abstract class ProxyReader extends FilterReader
A Proxy stream which acts as expected, that is it passes the method calls on to the proxied stream and doesn't change which methods are being called.

It is an alternative base class to FilterReader to increase reusability, because FilterReader changes the methods being called, such as read(char[]) to read(char[], int, int).

author
Stephen Colebourne
version
$Id: ProxyReader.java 610010 2008-01-08 14:50:59Z niallp $

Fields Summary
Constructors Summary
public ProxyReader(Reader proxy)
Constructs a new ProxyReader.

param
proxy the Reader to delegate to

        super(proxy);
        // the proxy is stored in a protected superclass variable named 'in'
    
Methods Summary
public voidclose()
Invokes the delegate's close() method.

throws
IOException if an I/O error occurs

        in.close();
    
public synchronized voidmark(int idx)
Invokes the delegate's mark(int) method.

param
idx read ahead limit
throws
IOException if an I/O error occurs

        in.mark(idx);
    
public booleanmarkSupported()
Invokes the delegate's markSupported() method.

return
true if mark is supported, otherwise false

        return in.markSupported();
    
public intread()
Invokes the delegate's read() method.

return
the character read or -1 if the end of stream
throws
IOException if an I/O error occurs

        return in.read();
    
public intread(char[] chr)
Invokes the delegate's read(char[]) method.

param
chr the buffer to read the characters into
return
the number of characters read or -1 if the end of stream
throws
IOException if an I/O error occurs

        return in.read(chr);
    
public intread(char[] chr, int st, int end)
Invokes the delegate's read(char[], int, int) method.

param
chr the buffer to read the characters into
param
st The start offset
param
end The number of bytes to read
return
the number of characters read or -1 if the end of stream
throws
IOException if an I/O error occurs

        return in.read(chr, st, end);
    
public booleanready()
Invokes the delegate's ready() method.

return
true if the stream is ready to be read
throws
IOException if an I/O error occurs

        return in.ready();
    
public synchronized voidreset()
Invokes the delegate's reset() method.

throws
IOException if an I/O error occurs

        in.reset();
    
public longskip(long ln)
Invokes the delegate's skip(long) method.

param
ln the number of bytes to skip
return
the number of bytes to skipped or -1 if the end of stream
throws
IOException if an I/O error occurs

        return in.skip(ln);