Interface IPackSerializer

All Known Implementing Classes:
JsonPackSerializer, SAXPackSerializer, YamlPackSerializer

public interface IPackSerializer
Format-agnostic serialization interface for 2Pack export. Implementations write to XML (SAX), JSON, or YAML. Each packOut operation uses one instance for its entire document lifecycle.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Write text content for the current element.
    default void
    Finalize the document.
    void
    Close the most recently opened element.
    void
    Open an element (record or field).
  • Method Details

    • startElement

      void startElement(String qName, Attributes atts) throws Exception
      Open an element (record or field).
      Parameters:
      qName - element name
      atts - element attributes (reference hints, type metadata)
      Throws:
      Exception
    • endElement

      void endElement(String qName) throws Exception
      Close the most recently opened element.
      Parameters:
      qName - element name
      Throws:
      Exception
    • characters

      void characters(String text) throws Exception
      Write text content for the current element.
      Parameters:
      text - content, may be null (treated as empty)
      Throws:
      Exception
    • endDocument

      default void endDocument() throws Exception
      Finalize the document. Called once after the root element is closed. The default no-op is sufficient for JSON/YAML serializers that flush on endElement(java.lang.String); XML implementations override to call TransformerHandler.endDocument().
      Throws:
      Exception