Skip to content

Instantly share code, notes, and snippets.

@luelista
Created May 6, 2011 10:05
Show Gist options
  • Save luelista/958717 to your computer and use it in GitHub Desktop.
Save luelista/958717 to your computer and use it in GitHub Desktop.
public static void saveData() throws Exception {
FileWriter w = new FileWriter("adressen.txt");
for(Person p : personen) {
p.writeToFile(w);
}
w.close();
}
public static void readData() throws Exception {
BufferedReader r = new BufferedReader(new FileReader("adressen.txt"));
while(true) {
String line = r.readLine();
//System.out.println("INFILE: '"+line+"'");
if (line==null) break;
if (line.equals("[Person]")) {
Person p = new Person();
p.readFromFile(r);
personen.add(p);
}
}
r.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment