Package org.apache.kafka.streams.kstream
Class Printed<K,V>
- java.lang.Object
- 
- org.apache.kafka.streams.kstream.Printed<K,V>
 
- 
- Type Parameters:
- K- key type
- V- value type
 
 public class Printed<K,V> extends Object An object to define the options used when printing aKStream.- See Also:
- KStream.print(Printed)
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected Stringlabelprotected KeyValueMapper<? super K,? super V,String>mapperprotected OutputStreamoutputStreamprotected StringprocessorName
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
 Printed<K,V>toFile(String filePath)Print the records of aKStreamto a file.static <K,V>
 Printed<K,V>toSysOut()Print the records of aKStreamto system out.Printed<K,V>withKeyValueMapper(KeyValueMapper<? super K,? super V,String> mapper)Print the records of aKStreamwith the providedKeyValueMapperThe provided KeyValueMapper's mapped value type must beString.Printed<K,V>withLabel(String label)Print the records of aKStreamwith the provided label.Printed<K,V>withName(String processorName)Print the records of aKStreamwith provided processor name.
 
- 
- 
- 
Field Detail- 
outputStreamprotected final OutputStream outputStream 
 - 
labelprotected String label 
 - 
processorNameprotected String processorName 
 - 
mapperprotected KeyValueMapper<? super K,? super V,String> mapper 
 
- 
 - 
Method Detail- 
toFilepublic static <K,V> Printed<K,V> toFile(String filePath) Print the records of aKStreamto a file.- Type Parameters:
- K- key type
- V- value type
- Parameters:
- filePath- path of the file
- Returns:
- a new Printed instance
 
 - 
toSysOutpublic static <K,V> Printed<K,V> toSysOut() Print the records of aKStreamto system out.- Type Parameters:
- K- key type
- V- value type
- Returns:
- a new Printed instance
 
 - 
withLabelpublic Printed<K,V> withLabel(String label) Print the records of aKStreamwith the provided label.- Parameters:
- label- label to use
- Returns:
- this
 
 - 
withKeyValueMapperpublic Printed<K,V> withKeyValueMapper(KeyValueMapper<? super K,? super V,String> mapper) Print the records of aKStreamwith the providedKeyValueMapperThe provided KeyValueMapper's mapped value type must beString.The example below shows how to customize output data. 
 Implementors will need to overridefinal KeyValueMapper<Integer, String, String> mapper = new KeyValueMapper<Integer, String, String>() { public String apply(Integer key, String value) { return String.format("(%d, %s)", key, value); } };toString()for keys and values that are not of typeString,Integeretc. to get meaningful information.- Parameters:
- mapper- mapper to use
- Returns:
- this
 
 
- 
 
-