org.apache.noggit
Class JSONWriter

java.lang.Object
  extended by org.apache.noggit.JSONWriter

public class JSONWriter
extends Object


Nested Class Summary
static interface JSONWriter.Writable
          Implement this interface on your class to support serialization
 
Field Summary
protected  int indent
           
protected  int level
           
protected  CharArr out
           
 
Constructor Summary
JSONWriter(CharArr out)
           
JSONWriter(CharArr out, int indentSize)
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level

protected int level

indent

protected int indent

out

protected final CharArr out
Constructor Detail

JSONWriter

public JSONWriter(CharArr out,
                  int indentSize)
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

public JSONWriter(CharArr out)
Method Detail

setIndentSize

public void setIndentSize(int indentSize)

indent

public void indent()

write

public void write(Object o)

handleUnknownClass

public void handleUnknownClass(Object o)
Override this method for custom handling of unknown classes. Also see the Writable interface.


write

public void write(Map val)

write

public void write(Collection val)

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

public void writeString(CharSequence str)

writeString

public void writeString(CharArr str)

writeStringStart

public void writeStringStart()

writeStringChars

public void writeStringChars(CharArr partialStr)

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

public void writeNumber(CharArr digits)

writePartialNumber

public void writePartialNumber(CharArr digits)

startObject

public void startObject()

endObject

public void endObject()

startArray

public void startArray()

endArray

public void endArray()

writeValueSeparator

public void writeValueSeparator()

writeNameSeparator

public void writeNameSeparator()


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.