JPachube - pachube thru Java in max

    Nov 29 2010 | 8:06 pm
    Hi everyone,
    I don't have a clue about java, generally. But I found this tutorial about using JPachube .
    Do you know how I can put this into max?
    Anyone willing to give a hand?

    • Dec 01 2010 | 12:59 pm
      i've just give a try, it works... here is a simple java class that allows you to get some data from pachube.
      import Pachube.Feed; import Pachube.Pachube; import com.cycling74.max.MaxObject; import; import; import; import;
      /** * * @author ge */ public class DataStream extends MaxObject {
      private String StreamID = ""; private int dsid = 0; Pachube p; Feed f;
      public DataStream(String id, int dsid) { this.StreamID = id; this.dsid = dsid; p = new Pachube("your_api_key"); f = new Feed(p); f.setId(id); }
      public void bang() { String s = new String(p.getDatastream(f.getId(), this.dsid).getBody().getBytes()); outlet(0, s);
      public void setFeedId(String s) { this.StreamID = s; this.f.setId(s); }
      public void setDataStreamId(int i) { this.dsid = i; }
      public void getFeeds() {
      try { URL feedsurl = new URL(""); URLConnection yc = feedsurl.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine;
      while ((inputLine = in.readLine()) != null) { outlet(0, inputLine.toString()); } in.close(); } catch (Exception e) { }
      } }
    • Feb 17 2012 | 11:11 pm
      Hey Guillaume!
      I just read your message. I had a solution to help me update info on pachube, but that doesn't seem to work that well.
      Can you please tell me how I can integrate what you posted? And maybe change it so it updates a feed instead of reading it?
      Thank you so much, ygreq