GraphStream Users

Archives de la liste Aide


null pointer at source.addSink(graph);


Chronologique Discussions 
  • From: <bgsrvey AT wordgraph.com>
  • To: graphstream-users AT litislab.fr
  • Subject: null pointer at source.addSink(graph);
  • Date: Wed, 4 Jul 2012 20:41:08 +0200 (CEST)


First try with GraphStream. I can't get over the hump of (FileSource) source
being null.

I will be grateful for any assistance. gs looks like a great accomplishment!


public class Tutorial2 {
public static void main(String args[]) {
Graph graph = new SingleGraph("Tutorial2");
String filePath = "tutorial2.dgs";
System.out.println("ID:" + graph.getId());
graph.display();

graph.addAttribute("ui.antialias");
try {
Thread.sleep(1000);
FileInputStream fstream = new
FileInputStream(filePath);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new
InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
System.out.println(strLine);
}
fstream.close();
FileSource source =
FileSourceFactory.sourceFor(filePath);
Thread.sleep(5000);
source.addSink(graph);
source.begin(filePath);
while (source.nextEvents());
source.end();
} catch (InterruptedException ix) {
System.out.println("interrupted while waiting on
invokeAndWait()");
} catch (IOException ioe) {
System.out.println("IOE");
ioe.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}



Archives gérées par MHonArc 2.6.16.

Top of page