Package jodd.json
Class JsonWriter
java.lang.Object
jodd.json.JsonWriter
- Direct Known Subclasses:
JsonContext
Simple JSON writer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final Appendableprotected booleanprotected Stringprotected final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected voidpopName()Writes stored name to JSON string.voidStores name to temporary stack.protected voidunicode(char c) Writes unicode representation of a character.protected voidwrite(char c) Appends char to the buffer.voidwrite(CharSequence charSequence) Appends char sequence to the buffer.voidWrites close array sign.voidWrites close object sign.voidWrites comma.voidWrites object's property name: string and a colon.voidwriteNumber(Number number) voidWrites open array sign.voidWrites open object sign.voidwriteString(String value) Write a quoted and escaped value to the output.
-
Field Details
-
out
-
strictStringEncoding
protected final boolean strictStringEncoding -
pushedName
-
pushedComma
protected boolean pushedComma -
isPushed
protected boolean isPushed
-
-
Constructor Details
-
JsonWriter
-
-
Method Details
-
pushName
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
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
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
Appends char sequence to the buffer. Used for numbers, nulls, booleans, etc. -
writeNumber
-
write
protected void write(char c) Appends char to the buffer. Used internally.
-