Class StreamingDatasetJsonWriter

java.lang.Object
com.inductiveautomation.ignition.common.StreamingDatasetJsonWriter
All Implemented Interfaces:
StreamingDatasetWriter

public class StreamingDatasetJsonWriter extends Object implements StreamingDatasetWriter
  • Constructor Summary

    Constructors
    Constructor
    Description
    StreamingDatasetJsonWriter(com.inductiveautomation.ignition.common.gson.stream.JsonWriter writer, Consumer<Exception> exceptionHandler)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean[]
    computeQualityMask(int columnCount, boolean supportsQuality)
    Returns a per-column flag for whether a quality code should be written after each column's value.
    void
    Notifies the writer to close- all data has been written.
    void
    Finishes the stream while indicating an error occurred.
    void
    initialize(String[] columnNames, Class<?>[] columnTypes, boolean supportsQuality, int expectedRows)
    Initializes the streaming dataset with important information, primarily the column names and types.
    void
    write(Object[] data, QualityCode[] quality)
    Writes a row of data to the dataset.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StreamingDatasetJsonWriter

      public StreamingDatasetJsonWriter(com.inductiveautomation.ignition.common.gson.stream.JsonWriter writer, Consumer<Exception> exceptionHandler)
  • Method Details

    • initialize

      public void initialize(String[] columnNames, Class<?>[] columnTypes, boolean supportsQuality, int expectedRows)
      Description copied from interface: StreamingDatasetWriter
      Initializes the streaming dataset with important information, primarily the column names and types. If supportsQuality is true, it is expected that every value added has an associated quality. expectedRows gives an idea as to how many rows will be returned- useful for progress indication. Should be -1 if the number cannot be known in advance.
      Specified by:
      initialize in interface StreamingDatasetWriter
      Parameters:
      columnNames - The names of the columns in the dataset.
      columnTypes - The types of the columns in the dataset.
      supportsQuality - Whether or not the dataset supports quality codes.
      expectedRows - -1 if not known, otherwise the number of rows that will be in the dataset.
    • computeQualityMask

      protected boolean[] computeQualityMask(int columnCount, boolean supportsQuality)
      Returns a per-column flag for whether a quality code should be written after each column's value. The default writes a quality code after every column whenever the dataset supports quality; subclasses can override to emit quality codes for a subset of columns. The qualityIncluded field in the resulting document is true if any column emits quality codes.
    • write

      public void write(Object[] data, QualityCode[] quality) throws Exception
      Description copied from interface: StreamingDatasetWriter
      Writes a row of data to the dataset. The data and quality arrays must be the same length, and the data array must be the same length as the number of columns in the dataset.
      Specified by:
      write in interface StreamingDatasetWriter
      Parameters:
      data - The data to write to the dataset.
      quality - The quality codes for the data.
      Throws:
      Exception
    • finish

      public void finish()
      Description copied from interface: StreamingDatasetWriter
      Notifies the writer to close- all data has been written. Should be called from a finally block.
      Specified by:
      finish in interface StreamingDatasetWriter
    • finishWithError

      public void finishWithError(Exception e)
      Description copied from interface: StreamingDatasetWriter
      Finishes the stream while indicating an error occurred. Either this, or the successful finish(), must be called.
      Specified by:
      finishWithError in interface StreamingDatasetWriter
      Parameters:
      e - The exception that occurred.