Class DefaultIndenter
java.lang.Object
tools.jackson.core.util.DefaultPrettyPrinter.NopIndenter
tools.jackson.core.util.DefaultIndenter
- All Implemented Interfaces:
Serializable, DefaultPrettyPrinter.Indenter
Default linefeed-based indenter, used by
DefaultPrettyPrinter (unless
overridden). Uses system-specific linefeeds and 2 spaces for indentation per level.- Since:
- 2.5
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final Stringprivate static final intWe expect to rarely get indentation deeper than this number of levels, and try not to pre-generate more indentations than needed.private final char[]private static final longstatic final Stringstatic final DefaultIndenter -
Constructor Summary
ConstructorsConstructorDescriptionIndent with two spaces and the system's default line feedDefaultIndenter(String indent, String eol) Create an indenter which uses theindentstring to indent one level and theeolstring to separate lines. -
Method Summary
Modifier and TypeMethodDescriptiongetEol()booleanisInline()withIndent(String indent) withLinefeed(String lf) voidwriteIndentation(JsonGenerator jg, int level) Methods inherited from class DefaultPrettyPrinter.NopIndenter
instance
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
SYS_LF
-
SYSTEM_LINEFEED_INSTANCE
-
INDENT_LEVELS
private static final int INDENT_LEVELSWe expect to rarely get indentation deeper than this number of levels, and try not to pre-generate more indentations than needed.- See Also:
-
indents
private final char[] indents -
charsPerLevel
private final int charsPerLevel -
eol
-
-
Constructor Details
-
DefaultIndenter
public DefaultIndenter()Indent with two spaces and the system's default line feed -
DefaultIndenter
-
-
Method Details
-
withLinefeed
-
withIndent
-
isInline
public boolean isInline()- Specified by:
isInlinein interfaceDefaultPrettyPrinter.Indenter- Overrides:
isInlinein classDefaultPrettyPrinter.NopIndenter- Returns:
- True if indenter is considered inline (does not add linefeeds), false otherwise
-
writeIndentation
- Specified by:
writeIndentationin interfaceDefaultPrettyPrinter.Indenter- Overrides:
writeIndentationin classDefaultPrettyPrinter.NopIndenter- Throws:
JacksonException
-
getEol
-
getIndent
-