Logo Search packages:      
Sourcecode: libjson-java version File versions

static JSONArray net::sf::json::JSONArray::_fromArray ( char[]  array,
JsonConfig  jsonConfig 
) [inline, static, private]

Construct a JSONArray from an char[].

Parameters:
array An char[] array.

Definition at line 763 of file JSONArray.java.

References net::sf::json::AbstractJSON::addInstance(), elements, net::sf::json::AbstractJSON::fireArrayEndEvent(), net::sf::json::AbstractJSON::fireArrayStartEvent(), net::sf::json::AbstractJSON::fireElementAddedEvent(), net::sf::json::AbstractJSON::fireErrorEvent(), net::sf::json::JsonConfig::getCycleDetectionStrategy(), net::sf::json::util::CycleDetectionStrategy::handleRepeatedReferenceAsArray(), JSONArray(), and net::sf::json::AbstractJSON::removeInstance().

                                                                              {
      fireArrayStartEvent( jsonConfig );
      if( !addInstance( array ) ){
         try{
            return jsonConfig.getCycleDetectionStrategy()
                  .handleRepeatedReferenceAsArray( array );
         }catch( JSONException jsone ){
            removeInstance( array );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }catch( RuntimeException e ){
            removeInstance( array );
            JSONException jsone = new JSONException( e );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }
      }
      JSONArray jsonArray = new JSONArray();
      for( int i = 0; i < array.length; i++ ){
         Character c = new Character( array[i] );
         jsonArray.elements.add( c );
         fireElementAddedEvent( i, c, jsonConfig );
      }

      removeInstance( array );
      fireArrayEndEvent( jsonConfig );
      return jsonArray;
   }


Generated by  Doxygen 1.6.0   Back to index