public class JSONWriter extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
JSONWriter.Writable
Implement this interface on your class to support serialization
|
Modifier and Type | Field and Description |
---|---|
protected int |
indent |
protected int |
level |
protected CharArr |
out |
Constructor and Description |
---|
JSONWriter(CharArr out) |
JSONWriter(CharArr out,
int indentSize) |
Modifier and Type | Method and Description |
---|---|
void |
endArray() |
void |
endObject() |
void |
handleUnknownClass(Object o)
Override this method for custom handling of unknown classes.
|
void |
indent() |
void |
setIndentSize(int indentSize) |
void |
startArray() |
void |
startObject() |
void |
write(boolean bool) |
void |
write(boolean[] val) |
void |
write(byte number) |
void |
write(byte[] val)
A byte[] may be either a single logical value, or a list of small integers.
|
void |
write(char[] val) |
void |
write(Collection val) |
void |
write(double number) |
void |
write(double[] val) |
void |
write(float number) |
void |
write(float[] val) |
void |
write(int number) |
void |
write(int[] val) |
void |
write(long number) |
void |
write(long[] val) |
void |
write(Map val) |
void |
write(Object o) |
void |
write(short number) |
void |
write(short[] val) |
void |
writeNameSeparator() |
void |
writeNull() |
void |
writeNumber(CharArr digits) |
void |
writePartialNumber(CharArr digits) |
void |
writeString(CharArr str) |
void |
writeString(CharSequence str) |
void |
writeStringChars(CharArr partialStr) |
void |
writeStringEnd() |
void |
writeStringStart() |
void |
writeValueSeparator() |
protected int level
protected int indent
protected final CharArr out
public JSONWriter(CharArr out, int indentSize)
out
- the CharArr to write the output to.indentSize
- The number of space characters to use as an indent (default 2). 0=newlines but no spaces, -1=no indent at all.public JSONWriter(CharArr out)
public void setIndentSize(int indentSize)
public void indent()
public void write(Object o)
public void handleUnknownClass(Object o)
public void write(Map val)
public void write(Collection val)
public void write(byte[] val)
public void write(short[] val)
public void write(int[] val)
public void write(long[] val)
public void write(float[] val)
public void write(double[] val)
public void write(boolean[] val)
public void write(short number)
public void write(byte number)
public void writeNull()
public void writeString(CharSequence str)
public void writeString(CharArr str)
public void writeStringStart()
public void writeStringChars(CharArr partialStr)
public void writeStringEnd()
public void write(long number)
public void write(int number)
public void write(double number)
public void write(float number)
public void write(boolean bool)
public void write(char[] val)
public void writeNumber(CharArr digits)
public void writePartialNumber(CharArr digits)
public void startObject()
public void endObject()
public void startArray()
public void endArray()
public void writeValueSeparator()
public void writeNameSeparator()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.