JSONWriter
Date: 2019-10-22

org.jmol.util

## Class JSONWriter

- java.lang.Object
- - org.jmol.util.JSONWriter

- Direct Known Subclasses:
    QCJSONWriter

      public class JSONWriter
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `indent`
    `private java.util.Map<java.lang.String,java.lang.String>` | `modifiedKeys` allows writing of one or more keys different from the original
    `protected javajs.util.OC` | `oc`
    `private static java.lang.String` | `SPACES`
    `private boolean` | `writeNullAsString`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected javajs.util.OC` | `append(java.lang.String s)`
    `void` | `arrayAdd(java.lang.Object o)`
    `void` | `arrayClose(boolean andIndent)`
    `void` | `arrayOpen(boolean andIndent)`
    `boolean` | `closeStream()`
    `protected java.lang.Object` | `getAndCheckValue(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String key)`
    `void` | `mapAddKey(java.lang.String key)`
    `void` | `mapAddKeyValue(java.lang.String key, java.lang.Object value, java.lang.String terminator)`
    `void` | `mapAddKeyValueRaw(java.lang.String key, java.lang.Object value, java.lang.String terminator)` Add a key:value pair where value is already quoted
    `void` | `mapAddMapAllExcept(java.lang.String key, java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String except)`
    `void` | `mapClose()`
    `void` | `mapOpen()`
    `void` | `setModifyKeys(java.util.Map<java.lang.String,java.lang.String> mapNewToOld)`
    `void` | `setStream(java.io.OutputStream os)`
    `void` | `setWriteNullAsString(boolean b)` Set option to write a null as the string "null" or just null itself.
    `void` | `writeArray(java.lang.Object o)`
    `void` | `writeBoolean(java.lang.Boolean o)`
    `void` | `writeList(java.util.List<java.lang.Object> list)`
    `void` | `writeMap(java.util.Map<java.lang.String,java.lang.Object> map)`
    `void` | `writeNull()`
    `void` | `writeNumber(java.lang.Number o)`
    `void` | `writeObject(java.lang.Object o)`
    `void` | `writeString(java.lang.String str)`
    `void` | `writeString(java.lang.String str, javajs.util.SB sbSym)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### oc

          protected javajs.util.OC oc

    - #### indent

          protected int indent

    - #### modifiedKeys

          private java.util.Map<java.lang.String,java.lang.String> modifiedKeys

      allows writing of one or more keys different from the original

    - #### writeNullAsString

          private boolean writeNullAsString

    - #### SPACES

          private static final java.lang.String SPACES

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JSONWriter

          public JSONWriter()

  - ### Method Detail

    - #### setModifyKeys

          public void setModifyKeys(java.util.Map<java.lang.String,java.lang.String> mapNewToOld)

    - #### setWriteNullAsString

          public void setWriteNullAsString(boolean b)

      Set option to write a null as the string "null" or just null itself.
      Parameters:
        `b` -

    - #### append

          protected javajs.util.OC append(java.lang.String s)

    - #### setStream

          public void setStream(java.io.OutputStream os)

    - #### closeStream

          public boolean closeStream()

    - #### writeObject

          public void writeObject(java.lang.Object o)

    - #### writeNull

          public void writeNull()

    - #### writeNumber

          public void writeNumber(java.lang.Number o)

    - #### writeBoolean

          public void writeBoolean(java.lang.Boolean o)

    - #### writeString

          public void writeString(java.lang.String str)

    - #### writeString

          public void writeString(java.lang.String str,
                                  javajs.util.SB sbSym)

    - #### writeMap

          public void writeMap(java.util.Map<java.lang.String,java.lang.Object> map)

    - #### getAndCheckValue

          protected java.lang.Object getAndCheckValue(java.util.Map<java.lang.String,java.lang.Object> map,
                                                      java.lang.String key)

    - #### mapOpen

          public void mapOpen()

    - #### mapClose

          public void mapClose()

    - #### mapAddKey

          public void mapAddKey(java.lang.String key)

    - #### mapAddKeyValue

          public void mapAddKeyValue(java.lang.String key,
                                     java.lang.Object value,
                                     java.lang.String terminator)

    - #### mapAddKeyValueRaw

          public void mapAddKeyValueRaw(java.lang.String key,
                                        java.lang.Object value,
                                        java.lang.String terminator)

      Add a key:value pair where value is already quoted
      Parameters:
        `key` -
        `value` -
        `terminator` - TODO

    - #### mapAddMapAllExcept

          public void mapAddMapAllExcept(java.lang.String key,
                                         java.util.Map<java.lang.String,java.lang.Object> map,
                                         java.lang.String except)

    - #### writeList

          public void writeList(java.util.List<java.lang.Object> list)

    - #### writeArray

          public void writeArray(java.lang.Object o)

    - #### arrayOpen

          public void arrayOpen(boolean andIndent)

    - #### arrayAdd

          public void arrayAdd(java.lang.Object o)

    - #### arrayClose

          public void arrayClose(boolean andIndent)