Class DataRecorder
java.lang.Object
de.iip_ecosphere.platform.services.environment.testing.DataRecorder
A simple, customizable data recorder for testing.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDataRecorder(File file, Function<Object, String> formatter) Creates an instance.DataRecorder(String file, Function<Object, String> formatter) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this recorder.voidemitChannel(boolean emitChannel) Shall channel information be emitted.voidRecords an object.
-
Field Details
-
JSON_FORMATTER
-
formatter
-
out
-
emitChannel
private boolean emitChannel
-
-
Constructor Details
-
DataRecorder
Creates an instance.- Parameters:
file- the file to write to; iffileis not writable, we will fall back to stdoutformatter- the formatter for data passed in byrecord(String, Object). If null, data will be emitted viaObject.toString().
-
DataRecorder
Creates an instance.- Parameters:
file- the file to write to; iffileis not writable, we will fall back to stdoutformatter- the formatter for data passed in byrecord(String, Object). If null, data will be emitted viaObject.toString().
-
-
Method Details
-
emitChannel
public void emitChannel(boolean emitChannel) Shall channel information be emitted.- Parameters:
emitChannel-truefor emit channel information,falseelse
-
record
Records an object.- Parameters:
channel- the output channel (may be empty or null for none)object- the object to be recorded
-
close
public void close()Closes this recorder.
-