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

public final Class SuffixLines

extends BaseParamFilterReader
implements ChainableReader
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.filters.ChainableReader
Imports
java.io.IOException, .Reader, org.apache.tools.ant.types.Parameter

Attaches a suffix to every line. Example:
<suffixlines suffix="Foo"/>
Or:
<filterreader classname="org.apache.tools.ant.filters.SuffixLines">
 <param name="suffix" value="Foo"/>
</filterreader>
Since
Ant 1.8.0

Field Summary

Modifier and TypeField and Description
private String
queuedData

Data that must be read from, if not null.

private String
suffix

The suffix to be used.

private static final String
SUFFIX_KEY

Parameter name for the prefix.

Constructor Summary

AccessConstructor and Description
public
SuffixLines()

Constructor for "dummy" instances.

public
SuffixLines(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
public Reader

Returns:

a new filter based on this configuration, but filtering the specified reader
chain
(final Reader
A Reader object providing the underlying stream. Must not be null.
rdr
)

Implements org.apache.tools.ant.filters.ChainableReader.chain.

Creates a new SuffixLines filter using the passed in Reader for instantiation.
private String

Returns:

the suffix which will be added at the end of each input line
getSuffix
()

Returns the suffix which will be added at the end of each input line.

private void
initialize()

Initializes the suffix if it is available from the parameters.

public int

Returns:

the next character in the resulting stream, or -1 if the end of the resulting stream has been reached
read
()

Overrides java.io.FilterReader.read.

Returns the next character in the filtered stream.
public void
setSuffix(final String
The suffix to add at the end of each input line. May be null, in which case no suffix is added.
suffix
)

Sets the suffix to add at the end of each input line.

Inherited from org.apache.tools.ant.filters.BaseParamFilterReader:
getParameterssetParameters

Field Detail

queuedDataback to summary
private String queuedData

Data that must be read from, if not null.

suffixback to summary
private String suffix

The suffix to be used.

SUFFIX_KEYback to summary
private static final String SUFFIX_KEY

Parameter name for the prefix.

Constructor Detail

SuffixLinesback to summary
public SuffixLines()

Constructor for "dummy" instances.

See Also
BaseFilterReader#BaseFilterReader()
SuffixLinesback to summary
public SuffixLines(final Reader in)

Creates a new filtered reader.

Parameters
in:Reader

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

Method Detail

chainback to summary
public Reader chain(final Reader rdr)

Implements org.apache.tools.ant.filters.ChainableReader.chain.

Creates a new SuffixLines filter using the passed in Reader for instantiation.

Parameters
rdr:Reader

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

Returns:Reader

a new filter based on this configuration, but filtering the specified reader

getSuffixback to summary
private String getSuffix()

Returns the suffix which will be added at the end of each input line.

Returns:String

the suffix which will be added at the end of each input line

initializeback to summary
private void initialize()

Initializes the suffix if it is available from the parameters.

readback to summary
public int read() throws IOException

Overrides java.io.FilterReader.read.

Returns the next character in the filtered stream. One line is read from the original input, and the suffix added. The resulting line is then used until it ends, at which point the next original line is read, etc.

Returns:int

the next character in the resulting stream, or -1 if the end of the resulting stream has been reached

Exceptions
IOException:
if the underlying stream throws an IOException during reading
setSuffixback to summary
public void setSuffix(final String suffix)

Sets the suffix to add at the end of each input line.

Parameters
suffix:String

The suffix to add at the end of each input line. May be null, in which case no suffix is added.