ObjectInputStream ois new ObjectInputStream new FileInputStream graphs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("graphs.txt"));
Graph obj = (Graph) ois.readObject();
boolean eof = false;
while (!eof){
try{
System.out.println(obj.adjMatrixToString());
obj = (Graph) ois.readObject();
} catch(EOFExeption e){
eof = true;
}
}