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

# Class ChainReaderHelper

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

public final class ChainReaderHelper extends Object
Process a FilterReader chain.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `ChainReaderHelper.ChainReader`
  Created type.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `int`
  `bufferSize`
  The size of the buffer to be used.
  `Vector<FilterChain>`
  `filterChains`
  Chain of filters
  `Reader`
  `primaryReader`
  The primary reader to which the reader chain is to be attached.

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ChainReaderHelper.ChainReader`
  `getAssembledReader()`
  Assemble the reader
  `Project`
  `getProject()`
  Get the project
  `String`
  `readFully​(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​(Vector<FilterChain> fchain)`
  Sets the collection of filter reader sets
  `void`
  `setPrimaryReader​(Reader rdr)`
  Sets the primary `Reader`
  `void`
  `setProject​(Project project)`
  Set the project to work with
  `ChainReaderHelper`
  `with​(Consumer<ChainReaderHelper> consumer)`
  Fluent mechanism to apply some `Consumer`.
  `ChainReaderHelper`
  `withBufferSize​(int size)`
  Fluent buffer size mutator.
  `ChainReaderHelper`
  `withFilterChains​(Iterable<FilterChain> filterChains)`
  Fluent `filterChains` mutator.
  `ChainReaderHelper`
  `withPrimaryReader​(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 Details

  - ### primaryReader

    public 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 Vector<FilterChain> filterChains
    Chain of filters

- ## Constructor Details

  - ### ChainReaderHelper

    public ChainReaderHelper()
    Default constructor.

  - ### ChainReaderHelper

    public ChainReaderHelper​(Project project, Reader primaryReader, Iterable<FilterChain> filterChains)
    Convenience constructor.
    Parameters:
      `project` - ditto
      `primaryReader` - ditto
      `filterChains` - ditto

- ## Method Details

  - ### setPrimaryReader

    public void setPrimaryReader​(Reader rdr)
    Sets the primary `Reader`
    Parameters:
      `rdr` - the reader object

  - ### withPrimaryReader

    public ChainReaderHelper withPrimaryReader​(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​(Vector<FilterChain> fchain)
    Sets the collection of filter reader sets
    Parameters:
      `fchain` - the filter chains collection

  - ### withFilterChains

    public ChainReaderHelper withFilterChains​(Iterable<FilterChain> filterChains)
    Fluent `filterChains` mutator.
    Parameters:
      `filterChains` - ditto
    Returns:
      `this`

  - ### with

    public ChainReaderHelper with​(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 String readFully​(Reader rdr) throws 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:
      `IOException` - if an error occurs