Class DocumentStyle
java.lang.Object
com.ultikits.ultitools.config.document.DocumentStyle
The layout facts of one config file that SnakeYAML's emitter needs to write the file the way it already
looks. Each fact is read from the file once, when it is parsed; a mixed file gets one style per fact.
- Line terminator - the file's first line break (
\r\n,\ror\n);\nfor a file without one. - Mapping indentation - the column offset of the first nested block mapping's keys from their parent key; 2 when there is none (Bukkit's default).
- List indicator indentation - the column offset of the first block sequence's
-from the key that holds it: 0 for 6.2-written files (- xunder the key), the offset for bundled files that indent items (- x). - Unicode escaping - a file whose scalars hold no raw non-ASCII character and at least one
\u,\Uor\xescape keeps writing non-ASCII text as escapes. Escapes follow the file's own form: the hex digits in the case the file uses, and a character up to U+00FF as a four-digit\uescape unless the file itself uses\x(SnakeYAML's emitter would write\x). - Line width - 80 (Bukkit's default, the width 6.2 folded long strings at) when the file holds a quoted or plain scalar spanning more than one line; unlimited otherwise, so a long line written by hand stays one line.
- Byte order mark and final line break - kept as found.
- Since:
- 6.3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classOne pass over the composed tree, recording the first occurrence of each layout fact. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intBukkit'sYamlConfigurationOptionsdefault width, which 6.2 wrote with.private final booleanprivate static final intprivate final booleanprivate final booleanprivate final intprivate final intprivate final booleanprivate final Stringprivate static final intprivate final booleanprivate final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDocumentStyle(String lineBreak, int indent, int indicatorIndent, boolean escapeUnicode, boolean upperCaseHex, boolean latin1AsUnicodeEscape, int width, boolean byteOrderMark, boolean finalLineBreak) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanstatic DocumentStyledefaults()The style of a new file: what Bukkit writes, without a line width limit.(package private) static DocumentStyleReads the style of a parsed file.private static StringdetectLineBreak(String text) (package private) org.yaml.snakeyaml.DumperOptionsThe emitter options for this style, with Bukkit's flow style and comment processing.(package private) boolean(package private) boolean(package private) String(package private) boolean
-
Field Details
-
BUKKIT_WIDTH
static final int BUKKIT_WIDTHBukkit'sYamlConfigurationOptionsdefault width, which 6.2 wrote with.- See Also:
-
DEFAULT_INDENT
private static final int DEFAULT_INDENT- See Also:
-
MAX_INDENT
private static final int MAX_INDENT- See Also:
-
lineBreak
-
indent
private final int indent -
indicatorIndent
private final int indicatorIndent -
escapeUnicode
private final boolean escapeUnicode -
upperCaseHex
private final boolean upperCaseHex -
latin1AsUnicodeEscape
private final boolean latin1AsUnicodeEscape -
width
private final int width -
byteOrderMark
private final boolean byteOrderMark -
finalLineBreak
private final boolean finalLineBreak
-
-
Constructor Details
-
DocumentStyle
private DocumentStyle(String lineBreak, int indent, int indicatorIndent, boolean escapeUnicode, boolean upperCaseHex, boolean latin1AsUnicodeEscape, int width, boolean byteOrderMark, boolean finalLineBreak)
-
-
Method Details
-
defaults
The style of a new file: what Bukkit writes, without a line width limit.- Returns:
- the default style
-
detect
Reads the style of a parsed file.- Parameters:
text- the file's text as readroot- the composed top-level mapping, ornullfor a file without content- Returns:
- the file's style
-
lineBreak
String lineBreak() -
upperCaseHex
boolean upperCaseHex() -
latin1AsUnicodeEscape
boolean latin1AsUnicodeEscape() -
byteOrderMark
boolean byteOrderMark() -
finalLineBreak
boolean finalLineBreak() -
dumperOptions
org.yaml.snakeyaml.DumperOptions dumperOptions()The emitter options for this style, with Bukkit's flow style and comment processing.- Returns:
- fresh dumper options
-
detectLineBreak
-