public final class ChainReaderHelper
extends Object
Process a FilterReader chain.
-
Nested Class Summary
Nested Classes
-
Field Summary
Fields
int
The size of the buffer to be used.
The primary reader to which the reader chain is to be attached.
-
Constructor Summary
Constructors
-
Method Summary
Read data from the reader and return the
contents as a string.
void
Sets the buffer size to be used.
void
Sets the collection of filter reader sets
void
void
Set the project to work with
Fluent mechanism to apply some
Consumer
.
Fluent buffer size mutator.
Fluent filterChains
mutator.
Fluent primary
Reader
mutator.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
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
Chain of filters
-
Constructor Details
-
ChainReaderHelper
public ChainReaderHelper()
Default constructor.
-
-
Method Details
-
setPrimaryReader
public void setPrimaryReader(Reader rdr)
- Parameters:
rdr
- the reader object
-
withPrimaryReader
Fluent primary
Reader
mutator.
- Parameters:
rdr
- Reader
- 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
Fluent filterChains
mutator.
- Parameters:
filterChains
- ditto
- Returns:
this
-
with
Fluent mechanism to apply some
Consumer
.
- Parameters:
consumer
- ditto
- Returns:
this
-
getAssembledReader
Assemble the reader
- Returns:
- the assembled reader
- Throws:
BuildException
- if an error occurs
-
readFully
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