Class JsonWriter.Format

  • Enclosing class:
    JsonWriter

    public static class JsonWriter.Format
    extends java.lang.Object
    Format definition for JSON.
    Since:
    1.4
    • Constructor Summary

      Constructors 
      Constructor Description
      Format()
      Create a new default Formatter.
      Format​(char[] lineIndenter, char[] newLine, int mode)
      Create a new Formatter.
      Format​(char[] lineIndenter, char[] newLine, int mode, NameCoder nameCoder)
      Create a new Formatter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      char[] getLineIndenter()
      Retrieve the lineIndenter.
      NameCoder getNameCoder()
      Retrieve the NameCoder.
      char[] getNewLine()
      Retrieve the newLine.
      int mode()
      Retrieve the mode flags of the formatter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SPACE_AFTER_LABEL

        public static int SPACE_AFTER_LABEL
      • COMPACT_EMPTY_ELEMENT

        public static int COMPACT_EMPTY_ELEMENT
      • lineIndenter

        private char[] lineIndenter
      • newLine

        private char[] newLine
      • mode

        private final int mode
      • nameCoder

        private final NameCoder nameCoder
    • Constructor Detail

      • Format

        public Format()
        Create a new default Formatter. The formatter uses two spaces, normal line feed character, adds a space after the label and will try to compact the output.
        Since:
        1.4.2
      • Format

        public Format​(char[] lineIndenter,
                      char[] newLine,
                      int mode)
        Create a new Formatter.
        Parameters:
        lineIndenter - the characters used for indenting the line
        newLine - the characters used to create a new line
        mode - the flags for the format modes
        Since:
        1.4
      • Format

        public Format​(char[] lineIndenter,
                      char[] newLine,
                      int mode,
                      NameCoder nameCoder)
        Create a new Formatter.
        Parameters:
        lineIndenter - the characters used for indenting the line
        newLine - the characters used to create a new line
        mode - the flags for the format modes
        nameCoder - the name encoder and decoder
        Since:
        1.4.2
    • Method Detail

      • getLineIndenter

        public char[] getLineIndenter()
        Retrieve the lineIndenter.
        Returns:
        the lineIndenter
        Since:
        1.4
      • getNewLine

        public char[] getNewLine()
        Retrieve the newLine.
        Returns:
        the newLine
        Since:
        1.4
      • mode

        public int mode()
        Retrieve the mode flags of the formatter.
        Returns:
        the mode
        Since:
        1.4
      • getNameCoder

        public NameCoder getNameCoder()
        Retrieve the NameCoder.
        Returns:
        the name coder
        Since:
        1.4.2