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

public final Class ConcatFilter

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

Concats a file before and/or after the file.

Example:

<copy todir="build">
    <fileset dir="src" includes="*.java"/>
    <filterchain>
        <concatfilter prepend="apache-license-java.txt"/>
    </filterchain>
</copy>

Copies all java sources from src to build and adds the content of apache-license-java.txt add the beginning of each file.

Since
1.6
Version
2003-09-23

Field Summary

Modifier and TypeField and Description
private File
append

File to add after the content.

private Reader
appendReader

Reader for append-file.

private File
prepend

File to add before the content.

private Reader
prependReader

Reader for prepend-file.

Constructor Summary

AccessConstructor and Description
public
ConcatFilter()

Constructor for "dummy" instances.

public
ConcatFilter(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 ConcatReader using the passed in Reader for instantiation.
public File

Returns:

append attribute
getAppend
()

Returns append attribute.

public File

Returns:

prepend attribute
getPrepend
()

Returns prepend attribute.

private void
initialize()

Scans the parameters list for the "lines" parameter and uses it to set the number of lines to be returned in the filtered stream.

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
setAppend(final File
new value
append
)

Sets append attribute.

public void
setPrepend(final File
new value
prepend
)

Sets prepend attribute.

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

Field Detail

appendback to summary
private File append

File to add after the content.

appendReaderback to summary
private Reader appendReader

Reader for append-file.

prependback to summary
private File prepend

File to add before the content.

prependReaderback to summary
private Reader prependReader

Reader for prepend-file.

Constructor Detail

ConcatFilterback to summary
public ConcatFilter()

Constructor for "dummy" instances.

See Also
BaseFilterReader#BaseFilterReader()
ConcatFilterback to summary
public ConcatFilter(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 ConcatReader 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

getAppendback to summary
public File getAppend()

Returns append attribute.

Returns:File

append attribute

getPrependback to summary
public File getPrepend()

Returns prepend attribute.

Returns:File

prepend attribute

initializeback to summary
private void initialize() throws IOException

Scans the parameters list for the "lines" parameter and uses it to set the number of lines to be returned in the filtered stream. also scan for skip parameter.

readback to summary
public int read() throws IOException

Overrides java.io.FilterReader.read.

Returns the next character in the filtered stream. If the desired number of lines have already been read, the resulting stream is effectively at an end. Otherwise, the next character from the underlying stream is read and returned.

Returns:int

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

Annotations
@Override
Exceptions
IOException:
if the underlying stream throws an IOException during reading
setAppendback to summary
public void setAppend(final File append)

Sets append attribute.

Parameters
append:File

new value

setPrependback to summary
public void setPrepend(final File prepend)

Sets prepend attribute.

Parameters
prepend:File

new value