Class Writer<T>

java.lang.Object
com.framed.core.Service
com.framed.io.writer.Writer<T>
Type Parameters:
T - the type of data to be written
Direct Known Subclasses:
MedibusParsedWriter, RawByteWriter

public abstract class Writer<T> extends Service
An abstract base class for writing data of type T to a specified file path.

This class extends Service and provides common functionality for writer implementations, such as tracking the start time for distinct output file names and managing the output path.

Concrete subclasses must implement the write(Object, String) method to define how data should be written to the file system.

  • Field Details

    • path

      protected Path path
      The file system path where data will be written.
    • timeOnStart

      protected long timeOnStart
      The timestamp (in milliseconds since epoch) when this writer instance was created.
  • Constructor Details

    • Writer

      protected Writer(String path, EventBus eventBus)
      Creates a new Writer instance.
      Parameters:
      path - the file system path as a string where data should be written
      eventBus - the event bus used for communication and event handling
  • Method Details

    • write

      public abstract void write(T data, String deviceName) throws IOException
      Writes the given data to the configured path. Concrete implementations must define how the data is serialized and stored.
      Parameters:
      data - the data to write
      deviceName - the name of the device associated with the data
      Throws:
      IOException - if an I/O error occurs during writing