Class IniWriter

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class IniWriter extends SerializerWriter<IniWriter>
Specialized writer for serializing INI format.

Extends SerializerWriter with INI-specific methods for sections, key-value pairs, comments, and quoted strings.

Notes:
  • This class is not intended for external use.
See Also:
  • Field Details

    • kvSeparator

      protected final char kvSeparator
      Key-value separator character.
    • spacedSeparator

      protected final boolean spacedSeparator
      Whether to add spaces around the separator.
  • Constructor Details

    • IniWriter

      protected IniWriter(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, char kvSeparator, boolean spacedSeparator, UriResolver uriResolver)
      Constructor.
      Parameters:
      out - The writer being wrapped.
      useWhitespace - If true, use blank lines between sections.
      maxIndent - The maximum indentation level (unused for INI).
      trimStrings - If true, trim strings before serialization.
      kvSeparator - The key-value separator ('=' or ':').
      spacedSeparator - If true, add spaces around separator.
      uriResolver - The URI resolver.
  • Method Details

    • section

      public IniWriter section(String name)
      Writes a section header with optional preceding blank line.
      Parameters:
      name - The section name or path (e.g. "address" or "employment/company").
      Must not be null.
      Returns:
      This object.
    • comment

      public IniWriter comment(String text)
      Writes a comment line.
      Parameters:
      text - The comment text.
      Can be null (writes an empty comment).
      Returns:
      This object.
    • keyValue

      public IniWriter keyValue(String key, String value)
      Writes a key-value pair.
      Parameters:
      key - The key name.
      Must not be null.
      value - The value (already formatted as string).
      Can be null (written as the literal "null").
      Returns:
      This object.
    • quotedString

      public IniWriter quotedString(String value)
      Writes a single-quoted string value with escaping.

      Single quotes within the value are escaped as ''.

      Parameters:
      value - The raw string value.
      Can be null (emitted as the literal "null").
      Returns:
      This object.
    • blankLine

      public IniWriter blankLine()
      Writes a blank line.
      Returns:
      This object.