private void parseStream(StreamInfo streamInfo,String json){
  try {
    JSONParser parser=new JSONParser();
    JSONObject root=(JSONObject)parser.parse(json);
    JSONObject stream=(JSONObject)root.get("stream");
    if (stream == null) {
      streamInfo.setOffline();
    }
 else {
      StreamInfo result=parseStream(stream,false);
      if (result == null || result != streamInfo) {
        LOGGER.warning("Error parsing stream (" + streamInfo.getStream() + "): "+ json);
        streamInfo.setUpdateFailed();
      }
    }
  }
 catch (  ParseException ex) {
    streamInfo.setUpdateFailed();
    LOGGER.warning("Error parsing stream info: " + ex.getLocalizedMessage());
  }
}

private void parseStream ( StreamInfo streamInfo , String json ) { try { JSONParser parser = new JSONParser ( ) ; JSONObject root = ( JSONObject ) parser . parse ( json ) ; JSONObject stream = ( JSONObject ) root . get ( "stream" ) ; if ( stream == null ) { streamInfo . setOffline ( ) ; } else { StreamInfo result = parseStream ( stream , false ) ; if ( result == null || result != streamInfo ) { LOGGER . warning ( "Error parsing stream (" + streamInfo . getStream ( ) + "): " + json ) ; streamInfo . setUpdateFailed ( ) ; } } } catch ( ParseException ex ) { streamInfo . setUpdateFailed ( ) ; LOGGER . warning ( "Error parsing stream info: " + ex . getLocalizedMessage ( ) ) ; } }
parses a single stream info response , which can contain a stream object if the stream is online . this parses the response to / streams / : channel /
