private static String getValue ( JSONTokener x ) throws JSONException { char c ; char q ; StringBuffer sb ; do { c = x . next ( ) ; } while ( c == ' ' || c == ' ' ) ; switch ( c ) { case 0 : return null ; case ' ' : case ' ' : q = c ; sb = new StringBuffer ( ) ; for ( ; ; ) { c = x . next ( ) ; if ( c == q ) { break ; } if ( c == 0 || c == ' ' || c == ' ' ) { throw x . syntaxError ( "Missing close quote '" + q + "'." ) ; } sb . append ( c ) ; } return sb . toString ( ) ; case ' ' : x . back ( ) ; return "" ; default : x . back ( ) ; return x . nextTo ( ' ' ) ; } }
Get the next value . The value can be wrapped in quotes . The value can be empty .