Package org.apache.tools.ant.filters.util

## Class ChainReaderHelper

- java.lang.Object
- - org.apache.tools.ant.filters.util.ChainReaderHelper

    public final class ChainReaderHelper
    extends java.lang.Object

Process a FilterReader chain.

### Nested Class Summary

Nested Classes
`class` `ChainReaderHelper.ChainReader` Created type.

### Field Summary

Fields
`int` `bufferSize` The size of the buffer to be used.
`java.util.Vector<FilterChain>` `filterChains` Chain of filters
`java.io.Reader` `primaryReader` The primary reader to which the reader chain is to be attached.

### Constructor Summary

Constructors
`ChainReaderHelper()` Default constructor.
`ChainReaderHelper​(Project project, java.io.Reader primaryReader, java.lang.Iterable<FilterChain> filterChains)` Convenience constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`ChainReaderHelper.ChainReader` `getAssembledReader()` Assemble the reader
`Project` `getProject()` Get the project
`java.lang.String` `readFully​(java.io.Reader rdr)` Read data from the reader and return the contents as a string.
`void` `setBufferSize​(int size)` Sets the buffer size to be used.
`void` `setFilterChains​(java.util.Vector<FilterChain> fchain)` Sets the collection of filter reader sets
`void` `setPrimaryReader​(java.io.Reader rdr)` Sets the primary `Reader`
`void` `setProject​(Project project)` Set the project to work with
`ChainReaderHelper` `with​(java.util.function.Consumer<ChainReaderHelper> consumer)` Fluent mechanism to apply some `Consumer`.
`ChainReaderHelper` `withBufferSize​(int size)` Fluent buffer size mutator.
`ChainReaderHelper` `withFilterChains​(java.lang.Iterable<FilterChain> filterChains)` Fluent `filterChains` mutator.
`ChainReaderHelper` `withPrimaryReader​(java.io.Reader rdr)` Fluent primary `Reader` mutator.
`ChainReaderHelper` `withProject​(Project project)` Fluent `Project` mutator.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### primaryReader

    public java.io.Reader primaryReader

The primary reader to which the reader chain is to be attached.

#### bufferSize

    public int bufferSize

The size of the buffer to be used.

#### filterChains

    public java.util.Vector<FilterChain> filterChains

Chain of filters

### Constructor Detail

#### ChainReaderHelper

    public ChainReaderHelper()

Default constructor.

#### ChainReaderHelper

    public ChainReaderHelper​(Project project,
                             java.io.Reader primaryReader,
                             java.lang.Iterable<FilterChain> filterChains)

Convenience constructor.

Parameters:
  `project` - ditto
  `primaryReader` - ditto
  `filterChains` - ditto

### Method Detail

#### setPrimaryReader

    public void setPrimaryReader​(java.io.Reader rdr)

Sets the primary `Reader`

Parameters:
  `rdr` - the reader object

#### withPrimaryReader

    public ChainReaderHelper withPrimaryReader​(java.io.Reader rdr)

Fluent primary `Reader` mutator.

Parameters:
  `rdr` - Reader
Returns:
  `this`

#### setProject

    public void setProject​(Project project)

Set the project to work with

Parameters:
  `project` - the current project

#### withProject

    public ChainReaderHelper withProject​(Project project)

Fluent `Project` mutator.

Parameters:
  `project` - ditto
Returns:
  `this`

#### getProject

    public Project getProject()

Get the project

Returns:
  the current project

#### setBufferSize

    public void setBufferSize​(int size)

Sets the buffer size to be used. Defaults to 8192, if this method is not invoked.

Parameters:
  `size` - the buffer size to use

#### withBufferSize

    public ChainReaderHelper withBufferSize​(int size)

Fluent buffer size mutator.

Parameters:
  `size` - ditto
Returns:
  `this`

#### setFilterChains

    public void setFilterChains​(java.util.Vector<FilterChain> fchain)

Sets the collection of filter reader sets

Parameters:
  `fchain` - the filter chains collection

#### withFilterChains

    public ChainReaderHelper withFilterChains​(java.lang.Iterable<FilterChain> filterChains)

Fluent `filterChains` mutator.

Parameters:
  `filterChains` - ditto
Returns:
  `this`

#### with

    public ChainReaderHelper with​(java.util.function.Consumer<ChainReaderHelper> consumer)

Fluent mechanism to apply some `Consumer`.

Parameters:
  `consumer` - ditto
Returns:
  `this`

#### getAssembledReader

    public ChainReaderHelper.ChainReader getAssembledReader()
                                                     throws BuildException

Assemble the reader

Returns:
  the assembled reader
Throws:
  `BuildException` - if an error occurs

#### readFully

    public java.lang.String readFully​(java.io.Reader rdr)
                               throws java.io.IOException

Read data from the reader and return the contents as a string.

Parameters:
  `rdr` - the reader object
Returns:
  the contents of the file as a string
Throws:
  `java.io.IOException` - if an error occurs