code: public JSON readFromStream( InputStream stream ) {
        try{
           StringBuffer xml = new StringBuffer();
           BufferedReader in = new BufferedReader( new InputStreamReader( stream ) );
           String line = null;
           while( (line = in.readLine()) != null ){
              xml.append( line );
           }
           return read( xml.toString() );
        }catch( IOException ioe ){
           throw new JSONException( ioe );
        }
     }
docs: Creates a JSON value from an input stream.
  
  @param stream
  @return a JSONNull, JSONObject or JSONArray
  @throws JSONException if the conversion from XML to JSON can't be made for
  I/O or format reasons.