Created
May 6, 2011 10:05
-
-
Save luelista/958717 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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