Package org.jmxtrans.agent.util.json
Class PrettyPrint
java.lang.Object
org.jmxtrans.agent.util.json.WriterConfig
org.jmxtrans.agent.util.json.PrettyPrint
public class PrettyPrint extends WriterConfig
Enables human readable JSON output by inserting whitespace between values.after commas and
colons. Example:
jsonValue.writeTo(writer, PrettyPrint.singleLine());
-
Field Summary
Fields inherited from class org.jmxtrans.agent.util.json.WriterConfig
MINIMAL -
Constructor Summary
Constructors Modifier Constructor Description protectedPrettyPrint(char[] indentChars) -
Method Summary
Modifier and Type Method Description protected org.jmxtrans.agent.util.json.JsonWritercreateWriter(Writer writer)static PrettyPrintindentWithSpaces(int number)Print every value on a separate line.static PrettyPrintindentWithTabs()Do not break lines, but still insert whitespace between values.static PrettyPrintsingleLine()Print every value on a separate line.
-
Constructor Details
-
PrettyPrint
protected PrettyPrint(char[] indentChars)
-
-
Method Details
-
singleLine
Print every value on a separate line. Use tabs (\t) for indentation.- Returns:
- A PrettyPrint instance for wrapped mode with tab indentation
-
indentWithSpaces
Print every value on a separate line. Use the given number of spaces for indentation.- Parameters:
number- the number of spaces to use- Returns:
- A PrettyPrint instance for wrapped mode with spaces indentation
-
indentWithTabs
Do not break lines, but still insert whitespace between values.- Returns:
- A PrettyPrint instance for single-line mode
-
createWriter
-