Package com.framed.communicator.io
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
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
FieldsModifier and TypeFieldDescriptionprotected PathThe file system path where data will be written.protected longThe timestamp (in milliseconds since epoch) when this writer instance was created. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
path
The file system path where data will be written. -
timeOnStart
protected long timeOnStartThe timestamp (in milliseconds since epoch) when this writer instance was created.
-
-
Constructor Details
-
Writer
Creates a new Writer instance.- Parameters:
path- the file system path as a string where data should be writteneventBus- the event bus used for communication and event handling
-
-
Method Details
-
write
Writes the given data to the configured path. Concrete implementations must define how the data is serialized and stored.- Parameters:
data- the data to writedeviceName- the name of the device associated with the data- Throws:
IOException- if an I/O error occurs during writing
-