Created
January 7, 2015 17:52
-
-
Save washingtonsoares/e72b3c971e5b0e8aea2c 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 void salvaContatos(ArrayList<Contato> lista) { | |
| BufferedWriter escritor = null; //objeto escritor | |
| try { | |
| escritor = new BufferedWriter(new FileWriter(new File("contatos"))); | |
| //Instanciação do objeto escritor | |
| for (Contato c : lista) { | |
| escritor.write(c.toString()); //Gravação do texto | |
| escritor.flush(); //descarga do buffer de escrita | |
| } | |
| escritor.close(); //fechamento do arquivo | |
| } catch (IOException e) { | |
| e.printStackTrace(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment