Class TabularArrayEncoder

java.lang.Object
dev.toonformat.jtoon.encoder.TabularArrayEncoder

public final class TabularArrayEncoder extends Object
Detects and encodes uniform arrays of objects in efficient tabular format. Tabular format declares field names once in a header and streams rows as CSV-like data.
  • Method Details

    • detectTabularHeader

      public static List<String> detectTabularHeader(tools.jackson.databind.node.ArrayNode rows)
      Detects if an array can be encoded in tabular format. Returns the header fields if tabular encoding is possible, empty list otherwise.
      Parameters:
      rows - The array to analyze
      Returns:
      List of field names for tabular header, or empty list if not tabular
    • encodeArrayOfObjectsAsTabular

      public static void encodeArrayOfObjectsAsTabular(String prefix, tools.jackson.databind.node.ArrayNode rows, List<String> header, LineWriter writer, int depth, EncodeOptions options)
      Encodes an array of objects as a tabular structure.
      Parameters:
      prefix - Optional key prefix
      rows - Array of uniform objects
      header - List of field names
      writer - LineWriter for output
      depth - Indentation depth
      options - Encoding options
    • writeTabularRows

      public static void writeTabularRows(tools.jackson.databind.node.ArrayNode rows, List<String> header, LineWriter writer, int depth, EncodeOptions options)
      Writes rows of tabular data by extracting values in header order. Public to allow ListItemEncoder to write rows after placing header on "- " line.
      Parameters:
      rows - Array of objects
      header - List of field names
      writer - LineWriter for output
      depth - Indentation depth
      options - Encoding options