Top Description Fields Constructors Methods
org.apache.tools.ant.filters

public abstract Class BaseFilterReader

extends FilterReader
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.filters.BaseParamFilterReader, org.apache.tools.ant.filters.ClassConstants, org.apache.tools.ant.filters.ExpandProperties, org.apache.tools.ant.filters.StripJavaComments, org.apache.tools.ant.filters.TokenFilter
Imports
java.io.FilterReader, .IOException, .Reader, .StringReader, org.apache.tools.ant.Project, org.apache.tools.ant.util.FileUtils

Base class for core filter readers.

Field Summary

Modifier and TypeField and Description
private static final int
BUFFER_SIZE

Buffer size used when reading

private boolean
initialized

Have the parameters passed been interpreted?

private Project
project

The Ant project this filter is part of.

Inherited from java.io.FilterReader:
in

Constructor Summary

AccessConstructor and Description
public
BaseFilterReader()

Constructor used by Ant's introspection mechanism.

public
BaseFilterReader(final Reader
A Reader object providing the underlying stream. Must not be null.
in
)

Creates a new filtered reader.

Method Summary

Modifier and TypeMethod and Description
protected final boolean

Returns:

whether or not the filter is initialized
getInitialized
()

Returns the initialized status.

protected final Project

Returns:

the project this filter is part of
getProject
()

Returns the project this filter is part of.

public final int

Returns:

the number of characters read, or -1 if the end of the stream has been reached
read
(final char[]
Destination buffer to write characters to. Must not be null.
cbuf
,
final int
Offset at which to start storing characters.
off
,
final int
Maximum number of characters to read.
len
)

Overrides java.io.FilterReader.read.

Reads characters into a portion of an array.
protected final String

Returns:

the remaining contents of the reader, as a String
readFully
()

Reads to the end of the stream, returning the contents as a String.

protected final String

Returns:

the line read, or null if the end of the stream has already been reached
readLine
()

Reads a line of text ending with '\n' (or until the end of the stream).

protected final void
setInitialized(final boolean
Whether or not the filter is initialized.
initialized
)

Sets the initialized status.

public final void
setProject(final Project
The project this filter is part of. Should not be null.
project
)

Sets the project to work with.

public final long

Returns:

the number of characters actually skipped
skip
(final long
The number of characters to skip
n
)

Overrides java.io.FilterReader.skip.

Skips characters.
Inherited from java.io.FilterReader:
closemarkmarkSupportedreadreadyreset

Field Detail

BUFFER_SIZEback to summary
private static final int BUFFER_SIZE

Buffer size used when reading

initializedback to summary
private boolean initialized

Have the parameters passed been interpreted?

projectback to summary
private Project project

The Ant project this filter is part of.

Constructor Detail

BaseFilterReaderback to summary
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.

BaseFilterReaderback to summary
public BaseFilterReader(final Reader in)

Creates a new filtered reader.

Parameters
in:Reader

A Reader object providing the underlying stream. Must not be null.

Method Detail

getInitializedback to summary
protected final boolean getInitialized()

Returns the initialized status.

Returns:boolean

whether or not the filter is initialized

getProjectback to summary
protected final Project getProject()

Returns the project this filter is part of.

Returns:Project

the project this filter is part of

readback to summary
public final int read(final char[] cbuf, final int off, final int len) throws IOException

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

Parameters
cbuf:char[]

Destination buffer to write characters to. Must not be null.

off:int

Offset at which to start storing characters.

len:int

Maximum number of characters to read.

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
readFullyback to summary
protected final String readFully() throws IOException

Reads to the end of the stream, returning the contents as a String.

Returns:String

the remaining contents of the reader, as a String

Exceptions
IOException:
if the underlying reader throws one during reading
readLineback to summary
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'.

Returns:String

the line read, or null if the end of the stream has already been reached

Exceptions
IOException:
if the underlying reader throws one during reading
setInitializedback to summary
protected final void setInitialized(final boolean initialized)

Sets the initialized status.

Parameters
initialized:boolean

Whether or not the filter is initialized.

setProjectback to summary
public final void setProject(final Project project)

Sets the project to work with.

Parameters
project:Project

The project this filter is part of. Should not be null.

skipback to summary
public final long skip(final long n) throws IOException, IllegalArgumentException

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

Parameters
n:long

The number of characters to skip

Returns:long

the number of characters actually skipped

Exceptions
IOException:
If an I/O error occurs
IllegalArgumentException:
If n is negative.