org.apache.tools.ant.filters
Class BaseFilterReader
FilterReader
org.apache.tools.ant.filters.BaseFilterReader
public abstract class BaseFilterReader
extends FilterReader
Base class for core filter readers.
protected boolean | getInitialized() - Returns the initialized status.
|
protected Project | getProject() - Returns the project this filter is part of.
|
int | read(char[] cbuf, int off, int len) - Reads characters into a portion of an array.
|
protected String | readFully() - Reads to the end of the stream, returning the contents as a String.
|
protected String | readLine() - Reads a line of text ending with '\n' (or until the end of the stream).
|
protected void | setInitialized(boolean initialized) - Sets the initialized status.
|
void | setProject(Project project) - Sets the project to work with.
|
long | skip(long n) - Skips characters.
|
BaseFilterReader
public BaseFilterReader()
Constructor used by Ant's introspection mechanism.
The original filter reader is only used for chaining
purposes, never for filtering purposes (and indeed
it would be useless for filtering purposes, as it has
no real data to filter). ChainedReaderHelper uses
this placeholder instance to create a chain of real filters.
BaseFilterReader
public BaseFilterReader(Reader in)
Creates a new filtered reader.
in
- A Reader object providing the underlying stream.
Must not be null
.
getInitialized
protected final boolean getInitialized()
Returns the initialized status.
- whether or not the filter is initialized
getProject
protected final Project getProject()
Returns the project this filter is part of.
- the project this filter is part of
read
public final int read(char[] cbuf,
int off,
int len)
throws IOException
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.
cbuf
- Destination buffer to write characters to.
Must not be null
.off
- Offset at which to start storing characters.len
- Maximum number of characters to read.
- the number of characters read, or -1 if the end of the
stream has been reached
readFully
protected final String readFully()
throws IOException
Reads to the end of the stream, returning the contents as a String.
- the remaining contents of the reader, as a String
readLine
protected final String readLine()
throws IOException
Reads a line of text ending with '\n' (or until the end of the stream).
The returned String retains the '\n'.
- the line read, or
null
if the end of the stream
has already been reached
setInitialized
protected final void setInitialized(boolean initialized)
Sets the initialized status.
initialized
- Whether or not the filter is initialized.
setProject
public final void setProject(Project project)
Sets the project to work with.
project
- The project this filter is part of.
Should not be null
.
skip
public final long skip(long n)
throws IOException,
IllegalArgumentException
Skips characters. This method will block until some characters are
available, an I/O error occurs, or the end of the stream is reached.
n
- The number of characters to skip
- the number of characters actually skipped