Processing Forum
Hello,
I am somewhat programing literate yet I am fairly new to processing. Could someone please explain this code.
All help is appreciated
URL url = new URL(feed); // An object to represent the URL // prepare a connection URLConnection conn = url.openConnection(); conn.connect(); // now connect to the Website // this is a bit of virtual plumbing as we connect // the data coming from the connection to a buffered // reader that reads the data one line at a time. BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); // read each line from the feed while ((data = in.readLine()) != null) { StringTokenizer st = new StringTokenizer(data,"\"<>,.()[] ");// break it down while (st.hasMoreTokens()) { // each chunk of data is made lowercase chunk= st.nextToken().toLowerCase() ; if (chunk.indexOf("love") >= 0 ) // found "love"? love++; // increment love by 1 if (chunk.indexOf("peace") >= 0) // found "peace"? peace++; // increment peace by 1 if (chunk.indexOf("arduino") >= 0) // found "arduino"? arduino++; // increment arduino by 1 } }
found on the make website.