org.apache.noggit
Class JSONUtil

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

public class JSONUtil
extends Object


Field Summary
static char ARRAY_END
           
static char ARRAY_START
           
static char[] FALSE_CHARS
           
static char[] HEX_CHARS
           
static char NAME_SEPARATOR
           
static char[] NULL_CHARS
           
static char OBJECT_END
           
static char OBJECT_START
           
static char[] TRUE_CHARS
           
static char VALUE_SEPARATOR
           
 
Constructor Summary
JSONUtil()
           
 
Method Summary
static String toJSON(Object o)
           
static String toJSON(Object o, int indentSize)
           
static void unicodeEscape(int ch, CharArr out)
           
static void writeBoolean(boolean val, CharArr out)
           
static void writeNull(CharArr out)
           
static void writeNumber(double number, CharArr out)
           
static void writeNumber(float number, CharArr out)
           
static void writeNumber(int number, CharArr out)
           
static void writeNumber(long number, CharArr out)
           
static void writeString(char[] val, int start, int end, CharArr out)
           
static void writeString(CharArr val, CharArr out)
           
static void writeString(CharSequence val, int start, int end, CharArr out)
           
static void writeStringPart(char[] val, int start, int end, CharArr out)
           
static void writeStringPart(CharSequence chars, int start, int end, CharArr out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE_CHARS

public static final char[] TRUE_CHARS

FALSE_CHARS

public static final char[] FALSE_CHARS

NULL_CHARS

public static final char[] NULL_CHARS

HEX_CHARS

public static final char[] HEX_CHARS

VALUE_SEPARATOR

public static final char VALUE_SEPARATOR
See Also:
Constant Field Values

NAME_SEPARATOR

public static final char NAME_SEPARATOR
See Also:
Constant Field Values

OBJECT_START

public static final char OBJECT_START
See Also:
Constant Field Values

OBJECT_END

public static final char OBJECT_END
See Also:
Constant Field Values

ARRAY_START

public static final char ARRAY_START
See Also:
Constant Field Values

ARRAY_END

public static final char ARRAY_END
See Also:
Constant Field Values
Constructor Detail

JSONUtil

public JSONUtil()
Method Detail

toJSON

public static String toJSON(Object o)

toJSON

public static String toJSON(Object o,
                            int indentSize)
Parameters:
o - The object to convert to JSON
indentSize - The number of space characters to use as an indent (default 2). 0=newlines but no spaces, -1=no indent at all.
Returns:
Given Object converted to its JSON representation using the given indentSize

writeNumber

public static void writeNumber(int number,
                               CharArr out)

writeNumber

public static void writeNumber(long number,
                               CharArr out)

writeNumber

public static void writeNumber(float number,
                               CharArr out)

writeNumber

public static void writeNumber(double number,
                               CharArr out)

writeString

public static void writeString(CharArr val,
                               CharArr out)

writeString

public static void writeString(char[] val,
                               int start,
                               int end,
                               CharArr out)

writeString

public static void writeString(CharSequence val,
                               int start,
                               int end,
                               CharArr out)

writeStringPart

public static void writeStringPart(char[] val,
                                   int start,
                                   int end,
                                   CharArr out)

writeStringPart

public static void writeStringPart(CharSequence chars,
                                   int start,
                                   int end,
                                   CharArr out)

unicodeEscape

public static void unicodeEscape(int ch,
                                 CharArr out)

writeNull

public static void writeNull(CharArr out)

writeBoolean

public static void writeBoolean(boolean val,
                                CharArr out)


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