Top Description Fields Constructors Methods
org.apache.commons.io.input

public abstract Class ProxyReader

extends FilterReader
Class Inheritance
Imports
java.io.FilterReader, .IOException, .Reader

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 471628 2006-11-06 04:06:45Z bayard $

Field Summary

Inherited from java.io.FilterReader:
in

Constructor Summary

AccessConstructor and Description
public
ProxyReader(Reader
the Reader to delegate to
proxy
)

Constructs a new ProxyReader.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.FilterReader.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.
public synchronized void
mark(int
Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
idx
)

Overrides java.io.FilterReader.mark.

Marks the present position in the stream.
public boolean
markSupported()

Overrides java.io.FilterReader.markSupported.

Tells whether this stream supports the mark() operation.
public int
read()

Overrides java.io.FilterReader.read.

Reads a single character.
public int
read(char[]
Destination buffer
chr
)

Overrides java.io.Reader.read.

Reads characters into an array.
public int
read(char[]
Destination buffer
chr
,
int
Offset at which to start storing characters
st
,
int
Maximum number of characters to read
end
)

Overrides java.io.FilterReader.read.

Reads characters into a portion of an array.
public boolean
ready()

Overrides java.io.FilterReader.ready.

Tells whether this stream is ready to be read.
public synchronized void
reset()

Overrides java.io.FilterReader.reset.

Resets the stream.
public long
skip(long
The number of characters to skip
ln
)

Overrides java.io.FilterReader.skip.

Skips characters.

Constructor Detail

ProxyReaderback to summary
public ProxyReader(Reader proxy)

Constructs a new ProxyReader.

Parameters
proxy:Reader

the Reader to delegate to

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.FilterReader.close.

Implements java.io.Closeable.close.

Doc from java.io.Reader.close.

Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

Exceptions
IOException:
If an I/O error occurs
See Also
java.io.Reader#close()
markback to summary
public synchronized void mark(int idx) throws IOException

Overrides java.io.FilterReader.mark.

Doc from java.io.FilterReader.mark.

Marks the present position in the stream.

Parameters
idx:int

Doc from java.io.Reader.mark.

Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.

Exceptions
IOException:
If an I/O error occurs
See Also
java.io.Reader#mark(int)
markSupportedback to summary
public boolean markSupported()

Overrides java.io.FilterReader.markSupported.

Doc from java.io.FilterReader.markSupported.

Tells whether this stream supports the mark() operation.

Returns:boolean

Doc from java.io.Reader.markSupported.

true if and only if this stream supports the mark operation.

See Also
java.io.Reader#markSupported()
readback to summary
public int read() throws IOException

Overrides java.io.FilterReader.read.

Doc from java.io.FilterReader.read.

Reads a single character.

Returns:int

Doc from java.io.Reader.read.

The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached

Exceptions
IOException:
If an I/O error occurs
See Also
java.io.Reader#read()
readback to summary
public int read(char[] chr) throws IOException

Overrides java.io.Reader.read.

Doc from java.io.Reader.read.

Reads 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.

If the length of cbuf is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Parameters
chr:char[]

Destination buffer

Returns:int

The number of characters read, or -1 if the end of the stream has been reached

Exceptions
IOException:
If an I/O error occurs
See Also
java.io.Reader#read(char[])
readback to summary
public int read(char[] chr, int st, int end) throws IOException

Overrides java.io.FilterReader.read.

Doc from java.io.FilterReader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Parameters
chr:char[]

Doc from java.io.Reader.read.

Destination buffer

st:int

Doc from java.io.Reader.read.

Offset at which to start storing characters

end:int

Doc from java.io.Reader.read.

Maximum number of characters to read

Returns:int

Doc from java.io.Reader.read.

The number of characters read, or -1 if the end of the stream has been reached

Exceptions
IOException:

Doc from java.io.Reader.read.

If an I/O error occurs

See Also
java.io.Reader#read(char[], int, int)
readyback to summary
public boolean ready() throws IOException

Overrides java.io.FilterReader.ready.

Doc from java.io.FilterReader.ready.

Tells whether this stream is ready to be read.

Returns:boolean

Doc from java.io.Reader.ready.

True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.

Exceptions
IOException:
If an I/O error occurs
See Also
java.io.Reader#ready()
resetback to summary
public synchronized void reset() throws IOException

Overrides java.io.FilterReader.reset.

Doc from java.io.FilterReader.reset.

Resets the stream.

Exceptions
IOException:
If an I/O error occurs
See Also
java.io.Reader#reset()
skipback to summary
public long skip(long ln) throws IOException

Overrides java.io.FilterReader.skip.

Doc from java.io.FilterReader.skip.

Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached. If the stream is already at its end before this method is invoked, then no characters are skipped and zero is returned.

Parameters
ln:long

Doc from java.io.Reader.skip.

The number of characters to skip

Returns:long

Doc from java.io.Reader.skip.

The number of characters actually skipped

Exceptions
IOException:

Doc from java.io.Reader.skip.

If an I/O error occurs

See Also
java.io.Reader#skip(long)