Exemplo n.º 1
0
 /**
  * @param aFile
  * @return
  * @throws IOException
  * @throws ParseException
  */
 private Project loadFlatFile(File aFile) throws java.io.IOException, ParseException {
   Project aProject = new Project();
   FileReader aFileReader = new FileReader(aFile);
   BufferedReader aReader = new BufferedReader(aFileReader);
   String line = aReader.readLine();
   while (line != null) {
     aProject.addPerson(assemblePerson(line));
     line = aReader.readLine();
   }
   aReader.close();
   return aProject;
 }
Exemplo n.º 2
0
 private void saveFlatFile(Project aProject, File aFile) throws IOException {
   FileWriter aFileWriter = new FileWriter(aFile);
   BufferedWriter aWriter = new BufferedWriter(aFileWriter);
   PrintWriter printWriter = new PrintWriter(aWriter);
   for (int i = 0; i < aProject.getPersonCount(); i++) {
     printWriter.println(
         aProject.getPerson(i).getName()
             + ";"
             + aProject.getPerson(i).getEmail()
             + ";"
             + parseDateToString(aProject.getPerson(i).getDateOfBirth()));
   }
   printWriter.close();
 }