JPachube – pachube thru Java in max

Nov 29, 2010 at 8:06pm

JPachube – pachube thru Java in max

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 1, 2010 at 12:59pm


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;

* @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);

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;

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(
String inputLine;

while ((inputLine = in.readLine()) != null) {
outlet(0, inputLine.toString());
} catch (Exception e) {


Feb 17, 2012 at 11:11pm

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,


You must be logged in to reply to this topic.