public class PrintForeachAction<K,V> extends java.lang.Object implements ForeachAction<K,V>
Constructor and Description |
---|
PrintForeachAction(java.io.PrintWriter printWriter,
java.lang.String streamName)
Print data message with given writer.
|
public PrintForeachAction(java.io.PrintWriter printWriter, java.lang.String streamName)
System.out
and the others. If the PrintWriter is PrintWriter(System.out)
,
then it would close System.out
output stream.
Afterall, not to pass in PrintWriter(System.out)
but null
instead.
printWriter
- Use System.out.println
if null
.streamName
- The given name will be printed.public void apply(K key, V value)
ForeachAction
apply
in interface ForeachAction<K,V>
key
- the key of the recordvalue
- the value of the recordpublic void close()