Package jodd.json
Class JsonWriter
- java.lang.Object
-
- jodd.json.JsonWriter
-
- Direct Known Subclasses:
JsonContext
public class JsonWriter extends java.lang.ObjectSimple JSON writer.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisPushedprotected java.lang.Appendableoutprotected booleanpushedCommaprotected java.lang.StringpushedNameprotected booleanstrictStringEncoding
-
Constructor Summary
Constructors Constructor Description JsonWriter(java.lang.Appendable out, boolean strictStringEncoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisNamePopped()protected voidpopName()Writes stored name to JSON string.voidpushName(java.lang.String name, boolean withComma)Stores name to temporary stack.protected voidunicode(char c)Writes unicode representation of a character.protected voidwrite(char c)Appends char to the buffer.voidwrite(java.lang.CharSequence charSequence)Appends char sequence to the buffer.voidwriteCloseArray()Writes close array sign.voidwriteCloseObject()Writes close object sign.voidwriteComma()Writes comma.voidwriteName(java.lang.String name)Writes object's property name: string and a colon.voidwriteNumber(java.lang.Number number)voidwriteOpenArray()Writes open array sign.voidwriteOpenObject()Writes open object sign.voidwriteString(java.lang.String value)Write a quoted and escaped value to the output.
-
-
-
Method Detail
-
pushName
public void pushName(java.lang.String name, boolean withComma)Stores name to temporary stack. Used when name's value may or may not be serialized (e.g. it may be excluded), in that case we do not need to write the name.
-
popName
protected void popName()
Writes stored name to JSON string. Cleans storage.
-
isNamePopped
public boolean isNamePopped()
-
writeOpenObject
public void writeOpenObject()
Writes open object sign.
-
writeCloseObject
public void writeCloseObject()
Writes close object sign.
-
writeName
public void writeName(java.lang.String name)
Writes object's property name: string and a colon.
-
writeOpenArray
public void writeOpenArray()
Writes open array sign.
-
writeCloseArray
public void writeCloseArray()
Writes close array sign.
-
writeString
public void writeString(java.lang.String value)
Write a quoted and escaped value to the output.
-
unicode
protected void unicode(char c)
Writes unicode representation of a character.
-
writeComma
public void writeComma()
Writes comma.
-
write
public void write(java.lang.CharSequence charSequence)
Appends char sequence to the buffer. Used for numbers, nulls, booleans, etc.
-
writeNumber
public void writeNumber(java.lang.Number number)
-
write
protected void write(char c)
Appends char to the buffer. Used internally.
-
-