Class Writer<T>

java.lang.Object
com.framed.core.Service
com.framed.communicator.io.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 Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Path
    The file system path where data will be written.
    protected long
    The timestamp (in milliseconds since epoch) when this writer instance was created.

    Fields inherited from class com.framed.core.Service

    eventBus, formatter, logger
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Writer(String path, EventBus eventBus)
    Creates a new Writer instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    write(T data, String deviceName)
    Writes the given data to the configured path.

    Methods inherited from class com.framed.core.Service

    stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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