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 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.java.util.Vector<FilterChain>
filterChains
Chain of filtersjava.io.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, java.io.Reader primaryReader, java.lang.Iterable<FilterChain> filterChains)
Convenience constructor. -
Method Summary
Modifier and Type Method Description ChainReaderHelper.ChainReader
getAssembledReader()
Assemble the readerProject
getProject()
Get the projectjava.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 setsvoid
setPrimaryReader(java.io.Reader rdr)
Sets the primaryReader
void
setProject(Project project)
Set the project to work withChainReaderHelper
with(java.util.function.Consumer<ChainReaderHelper> consumer)
Fluent mechanism to apply someConsumer
.ChainReaderHelper
withBufferSize(int size)
Fluent buffer size mutator.ChainReaderHelper
withFilterChains(java.lang.Iterable<FilterChain> filterChains)
FluentfilterChains
mutator.ChainReaderHelper
withPrimaryReader(java.io.Reader rdr)
Fluent primaryReader
mutator.ChainReaderHelper
withProject(Project project)
FluentProject
mutator.
-
Field Details
-
primaryReader
public java.io.Reader primaryReaderThe primary reader to which the reader chain is to be attached. -
bufferSize
public int bufferSizeThe size of the buffer to be used. -
filterChains
Chain of filters
-
-
Constructor Details
-
ChainReaderHelper
public ChainReaderHelper()Default constructor. -
ChainReaderHelper
public ChainReaderHelper(Project project, java.io.Reader primaryReader, java.lang.Iterable<FilterChain> filterChains)Convenience constructor.- Parameters:
project
- dittoprimaryReader
- dittofilterChains
- ditto
-
-
Method Details
-
setPrimaryReader
public void setPrimaryReader(java.io.Reader rdr)Sets the primaryReader
- Parameters:
rdr
- the reader object
-
withPrimaryReader
Fluent primaryReader
mutator.- Parameters:
rdr
- Reader- Returns:
this
-
setProject
Set the project to work with- Parameters:
project
- the current project
-
withProject
FluentProject
mutator.- Parameters:
project
- ditto- Returns:
this
-
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
Fluent buffer size mutator.- Parameters:
size
- ditto- Returns:
this
-
setFilterChains
Sets the collection of filter reader sets- Parameters:
fchain
- the filter chains collection
-
withFilterChains
FluentfilterChains
mutator.- Parameters:
filterChains
- ditto- Returns:
this
-
with
Fluent mechanism to apply someConsumer
.- Parameters:
consumer
- ditto- Returns:
this
-
getAssembledReader
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.IOExceptionRead 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
-