java.lang.Object
de.iip_ecosphere.platform.services.environment.testing.DataRecorder

public class DataRecorder extends Object
A simple, customizable data recorder for testing.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

    • DataRecorder

      public DataRecorder(String file, Function<Object,String> formatter)
      Creates an instance.
      Parameters:
      file - the file to write to; if file is not writable, we will fall back to stdout
      formatter - the formatter for data passed in by record(String, Object). If null, data will be emitted via Object.toString().
    • DataRecorder

      public DataRecorder(File file, Function<Object,String> formatter)
      Creates an instance.
      Parameters:
      file - the file to write to; if file is not writable, we will fall back to stdout
      formatter - the formatter for data passed in by record(String, Object). If null, data will be emitted via Object.toString().
  • Method Details

    • emitChannel

      public void emitChannel(boolean emitChannel)
      Shall channel information be emitted.
      Parameters:
      emitChannel - true for emit channel information, false else
    • record

      public void record(String channel, Object object)
      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.