Package org.noggit
Class JSONWriter
java.lang.Object
org.noggit.JSONWriter
- Version:
- $Id: JSONWriter.java 1211150 2011-12-06 21:10:01Z yonik $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Implement this interface on your class to support serialization -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
endArray()
void
void
Override this method for custom handling of unknown classes.void
indent()
void
setIndentSize
(int indentSize) void
void
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
(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
(short number) void
write
(short[] val) void
void
write
(Collection<?> val) void
void
void
void
writeNumber
(CharArr digits) void
writePartialNumber
(CharArr digits) void
writeString
(CharSequence str) void
writeString
(CharArr str) void
writeStringChars
(CharArr partialStr) void
void
void
-
Field Details
-
level
protected int level -
indent
protected int indent -
out
-
-
Constructor Details
-
JSONWriter
- Parameters:
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.
-
JSONWriter
-
-
Method Details
-
setIndentSize
public void setIndentSize(int indentSize) -
indent
public void indent() -
write
-
handleUnknownClass
Override this method for custom handling of unknown classes. Also see the Writable interface. -
write
-
write
-
write
public void write(byte[] val) A byte[] may be either a single logical value, or a list of small integers. It's up to the implementation to decide. -
write
public void write(short[] val) -
write
public void write(int[] val) -
write
public void write(long[] val) -
write
public void write(float[] val) -
write
public void write(double[] val) -
write
public void write(boolean[] val) -
write
public void write(short number) -
write
public void write(byte number) -
writeNull
public void writeNull() -
writeString
-
writeString
-
writeStringStart
public void writeStringStart() -
writeStringChars
-
writeStringEnd
public void writeStringEnd() -
write
public void write(long number) -
write
public void write(int number) -
write
public void write(double number) -
write
public void write(float number) -
write
public void write(boolean bool) -
write
public void write(char[] val) -
writeNumber
-
writePartialNumber
-
startObject
public void startObject() -
endObject
public void endObject() -
startArray
public void startArray() -
endArray
public void endArray() -
writeValueSeparator
public void writeValueSeparator() -
writeNameSeparator
public void writeNameSeparator()
-