Package org.jmol.util
Class JSONWriter
- java.lang.Object
-
- org.jmol.util.JSONWriter
-
- Direct Known Subclasses:
QCJSONWriter
public class JSONWriter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected int
indent
private Map<String,String>
modifiedKeys
allows writing of one or more keys different from the originalprotected javajs.util.OC
oc
private static String
SPACES
private boolean
whiteSpace
private boolean
writeNullAsString
private String
ws
-
Constructor Summary
Constructors Constructor Description JSONWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javajs.util.OC
append(String s)
void
arrayAdd(Object o)
void
arrayClose(boolean andIndent)
void
arrayOpen(boolean andIndent)
boolean
closeStream()
protected Object
getAndCheckValue(Map<String,Object> map, String key)
void
mapAddKey(String key)
void
mapAddKeyValue(String key, Object value, String terminator)
void
mapAddKeyValueRaw(String key, Object value, String terminator)
Add a key:value pair where value is already quotedvoid
mapAddMapAllExcept(String key, Map<String,Object> map, String except)
void
mapClose()
void
mapOpen()
void
setModifyKeys(Map<String,String> mapNewToOld)
void
setStream(OutputStream os)
void
setWhiteSpace(boolean b)
void
setWriteNullAsString(boolean b)
Set option to write a null as the string "null" or just null itself.void
writeArray(Object o)
void
writeBoolean(Boolean o)
void
writeList(List<Object> list)
void
writeMap(Map<String,Object> map)
void
writeNull()
void
writeNumber(Number o)
void
writeObject(Object o)
void
writeString(String str)
void
writeString(String str, javajs.util.SB sbSym)
-
-
-
Field Detail
-
oc
protected javajs.util.OC oc
-
indent
protected int indent
-
modifiedKeys
private Map<String,String> modifiedKeys
allows writing of one or more keys different from the original
-
writeNullAsString
private boolean writeNullAsString
-
whiteSpace
private boolean whiteSpace
-
ws
private String ws
-
SPACES
private static final String SPACES
- See Also:
- Constant Field Values
-
-
Method Detail
-
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(String s)
-
setStream
public void setStream(OutputStream os)
-
closeStream
public boolean closeStream()
-
writeObject
public void writeObject(Object o)
-
writeNull
public void writeNull()
-
writeNumber
public void writeNumber(Number o)
-
writeBoolean
public void writeBoolean(Boolean o)
-
writeString
public void writeString(String str)
-
writeString
public void writeString(String str, javajs.util.SB sbSym)
-
mapOpen
public void mapOpen()
-
mapClose
public void mapClose()
-
mapAddKey
public void mapAddKey(String key)
-
mapAddKeyValueRaw
public void mapAddKeyValueRaw(String key, Object value, String terminator)
Add a key:value pair where value is already quoted- Parameters:
key
-value
-terminator
- TODO
-
mapAddMapAllExcept
public void mapAddMapAllExcept(String key, Map<String,Object> map, String except)
-
writeArray
public void writeArray(Object o)
-
arrayOpen
public void arrayOpen(boolean andIndent)
-
arrayAdd
public void arrayAdd(Object o)
-
arrayClose
public void arrayClose(boolean andIndent)
-
setWhiteSpace
public void setWhiteSpace(boolean b)
-
-