public JSONRPCRequest buildRPCRequest( Reader reader ) 
	throws NullPointerException,
	       JSONSyntaxException,
	       JSONRPCException,
	       JSONException,
	       IOException {

	if( reader == null )
	    throw new NullPointerException( "Cannot read JSONRPCRequest from null reader." );


	// Create JSONRPCValueFactory 
	JSONValueFactory factory = new JSONRPCValueFactory();	    


	// Initialising parser/builder 
	ConfigurableJSONBuilder b  = new ConfigurableJSONBuilder( reader, false, factory );

	
	// start the pasrer
	b.parse();

	JSONValue json = b.getResult();
	
	if( json == null )
	    throw new JSONSyntaxException( "The passed data is empty and contains no JSON value." );
	

	//System.out.println( "JSON object: " + json.toString() );	
	if( !(json instanceof JSONRPCRequest) )
	    throw new JSONRPCException( "Retrieved value is NOT an instance of JSONRPCRequest. Found: " + json.getClass().getName() );
	

	// Explicit type cast :(
	return (JSONRPCRequest)json;
    }