com.sun.grizzly.cometd.util
Class JSONParser

java.lang.Object
  extended by com.sun.grizzly.cometd.util.JSONParser

public class JSONParser
extends Object


Nested Class Summary
static interface JSONParser.Generator
           
static class JSONParser.Literal
          A Literal JSONParser generator A utility instance of JSONParser.Generator that holds a pre-generated string on JSONParser text.
 
Method Summary
static void append(StringBuffer buffer, Object object)
          Append object as JSONParser to string buffer.
static byte convertHexDigit(byte b)
           
static Object parse(String s)
           
static String quote(String s)
          Quote a string.
static void quote(StringBuffer buf, String s)
          Quote a string into a StringBuffer.
static String toString(Map object)
           
static String toString(Object object)
           
static String toString(Object[] array)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toString

public static String toString(Object object)

toString

public static String toString(Map object)

toString

public static String toString(Object[] array)

parse

public static Object parse(String s)
Parameters:
s - String containing JSONParser object or array.
Returns:
A Map, Object array or primitive array parsed from the JSONParser.

append

public static void append(StringBuffer buffer,
                          Object object)
Append object as JSONParser to string buffer.

Parameters:
buffer -
object -

quote

public static String quote(String s)
Quote a string. The string is quoted only if quoting is required due to embeded delimiters, quote characters or the empty string.

Parameters:
s - The string to quote.
Returns:
quoted string

quote

public static void quote(StringBuffer buf,
                         String s)
Quote a string into a StringBuffer. The characters ", \, \n, \r, \t, \f and \b are escaped

Parameters:
buf - The StringBuffer
s - The String to quote.

convertHexDigit

public static byte convertHexDigit(byte b)
Parameters:
b - An ASCII encoded character 0-9 a-f A-F
Returns:
The byte value of the character 0-16.


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.