Class PrettyPrintJSONWriter


  • public class PrettyPrintJSONWriter
    extends JSONWriter
    A JSONWriter dedicated to create indented/pretty printed output.
    Since:
    1.1
    • Field Detail

      • DEFAULT_INDENT_STR

        public static final java.lang.String DEFAULT_INDENT_STR
        See Also:
        Constant Field Values
      • NEWLINE

        public static final java.lang.String NEWLINE
    • Constructor Detail

      • PrettyPrintJSONWriter

        public PrettyPrintJSONWriter​(java.io.Writer w)
      • PrettyPrintJSONWriter

        public PrettyPrintJSONWriter​(java.io.Writer w,
                                     java.lang.String indentStr)
    • Method Detail

      • array

        public JSONWriter array()
        Description copied from class: JSONWriter
        Begin appending a new array. All values until the balancing endArray will be appended to this array. The endArray method must be called to mark the array's end.
        Overrides:
        array in class JSONWriter
        Returns:
        this
      • endArray

        public JSONWriter endArray()
        Description copied from class: JSONWriter
        End an array. This method most be called to balance calls to array.
        Overrides:
        endArray in class JSONWriter
        Returns:
        this
      • object

        public JSONWriter object()
        Description copied from class: JSONWriter
        Begin appending a new object. All keys and values until the balancing endObject will be appended to this object. The endObject method must be called to mark the object's end.
        Overrides:
        object in class JSONWriter
        Returns:
        this
      • endObject

        public JSONWriter endObject()
        Description copied from class: JSONWriter
        End an object. This method most be called to balance calls to object.
        Overrides:
        endObject in class JSONWriter
        Returns:
        this
      • key

        public JSONWriter key​(java.lang.String s)
        Description copied from class: JSONWriter
        Append a key. The key will be associated with the next value. In an object, every value must be preceded by a key.
        Overrides:
        key in class JSONWriter
        Parameters:
        s - A key string.
        Returns:
        this