Package org.apache.juneau.marshall.ini
Class IniWriter
java.lang.Object
java.io.Writer
org.apache.juneau.marshall.serializer.SerializerWriter<IniWriter>
org.apache.juneau.marshall.ini.IniWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final charKey-value separator character.protected final booleanWhether to add spaces around the separator.Fields inherited from class org.apache.juneau.marshall.serializer.SerializerWriter
maxIndent, out, quoteChar, trimStrings, uriResolver, useWhitespace -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIniWriter(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, char kvSeparator, boolean spacedSeparator, UriResolver uriResolver) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionWrites a blank line.Writes a comment line.Writes a key-value pair.quotedString(String value) Writes a single-quoted string value with escaping.Writes a section header with optional preceding blank line.
-
Field Details
-
kvSeparator
Key-value separator character. -
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- Iftrue , use blank lines between sections.maxIndent- The maximum indentation level (unused for INI).trimStrings- Iftrue , trim strings before serialization.kvSeparator- The key-value separator ('=' or ':').spacedSeparator- Iftrue , add spaces around separator.uriResolver- The URI resolver.
-
-
Method Details
-
section
Writes a section header with optional preceding blank line.- Parameters:
name- The section name or path (e.g. "address" or "employment/company").
Must not benull .- Returns:
- This object.
-
comment
Writes a comment line.- Parameters:
text- The comment text.
Can benull (writes an empty comment).- Returns:
- This object.
-
keyValue
Writes a key-value pair.- Parameters:
key- The key name.
Must not benull .value- The value (already formatted as string).
Can benull (written as the literal"null" ).- Returns:
- This object.
-
quotedString
Writes a single-quoted string value with escaping.Single quotes within the value are escaped as
'' .- Parameters:
value- The raw string value.
Can benull (emitted as the literal"null" ).- Returns:
- This object.
-
blankLine
Writes a blank line.- Returns:
- This object.
-