org.apache.commons.io.input

Class 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).

Version: $Id: ProxyReader.java 610010 2008-01-08 14:50:59Z niallp $

Author: Stephen Colebourne

Constructor Summary
ProxyReader(Reader proxy)
Constructs a new ProxyReader.
Method Summary
voidclose()
Invokes the delegate's close() method.
voidmark(int idx)
Invokes the delegate's mark(int) method.
booleanmarkSupported()
Invokes the delegate's markSupported() method.
intread()
Invokes the delegate's read() method.
intread(char[] chr)
Invokes the delegate's read(char[]) method.
intread(char[] chr, int st, int end)
Invokes the delegate's read(char[], int, int) method.
booleanready()
Invokes the delegate's ready() method.
voidreset()
Invokes the delegate's reset() method.
longskip(long ln)
Invokes the delegate's skip(long) method.

Constructor Detail

ProxyReader

public ProxyReader(Reader proxy)
Constructs a new ProxyReader.

Parameters: proxy the Reader to delegate to

Method Detail

close

public void close()
Invokes the delegate's close() method.

Throws: IOException if an I/O error occurs

mark

public void mark(int idx)
Invokes the delegate's mark(int) method.

Parameters: idx read ahead limit

Throws: IOException if an I/O error occurs

markSupported

public boolean markSupported()
Invokes the delegate's markSupported() method.

Returns: true if mark is supported, otherwise false

read

public int read()
Invokes the delegate's read() method.

Returns: the character read or -1 if the end of stream

Throws: IOException if an I/O error occurs

read

public int read(char[] chr)
Invokes the delegate's read(char[]) method.

Parameters: chr the buffer to read the characters into

Returns: the number of characters read or -1 if the end of stream

Throws: IOException if an I/O error occurs

read

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

Parameters: chr the buffer to read the characters into st The start offset end The number of bytes to read

Returns: the number of characters read or -1 if the end of stream

Throws: IOException if an I/O error occurs

ready

public boolean ready()
Invokes the delegate's ready() method.

Returns: true if the stream is ready to be read

Throws: IOException if an I/O error occurs

reset

public void reset()
Invokes the delegate's reset() method.

Throws: IOException if an I/O error occurs

skip

public long skip(long ln)
Invokes the delegate's skip(long) method.

Parameters: ln the number of bytes to skip

Returns: the number of bytes to skipped or -1 if the end of stream

Throws: IOException if an I/O error occurs

Copyright (c) 2002-2011 Apache Software Foundation