public class ValueFilter<T> extends java.lang.Object implements StreamFilter
StreamFilter
that reads and writes T
-values.
This filter deserialises the input stream into memory as a T
-value
t
, gives t
to a setter function to produce a new T
-value t'
, and then serialises t'
to the output stream.Constructor and Description |
---|
ValueFilter(SourceReader<java.io.InputStream,T> reader,
SinkWriter<T,java.io.OutputStream> writer,
java.util.function.Function<T,T> setter)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
processE(java.io.InputStream in,
java.io.OutputStream out)
Reads from the input stream and writes to the output stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
process
public ValueFilter(SourceReader<java.io.InputStream,T> reader, SinkWriter<T,java.io.OutputStream> writer, java.util.function.Function<T,T> setter)
reader
- deserialises the input stream.writer
- serialises a T
-value to the output stream.setter
- given the deserialised value, produces the value to
serialise to the output stream.java.lang.NullPointerException
- if any argument is null
.public void processE(java.io.InputStream in, java.io.OutputStream out) throws java.lang.Exception
StreamFilter
processE
in interface StreamFilter
in
- the data to read.out
- where this method will write its output data.java.lang.NullPointerException
- if any argument is null
.java.lang.Exception
- If any other error occurs.