Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.ArrayList;
- public class LoadFichOb implements Serializable{
- private ObjectInputStream iS;
- private ObjectOutputStream oS;
- /** Método para guardar o estado atual do programa antes de este ser encerrado
- * @param lista_users
- * @throws java.io.IOException
- */
- public void saveUsers(ArrayList lista_users) throws IOException{
- try {
- oS = new ObjectOutputStream(new FileOutputStream("Lista Users.txt"));
- oS.writeObject(lista_users);
- oS.close();
- } catch (IOException ex) {
- System.out.println("Ocorreu um erro: "+ex);
- }
- }
- /** Método para resumir o estado do programa antes de ser encerrado
- * @return Dei objeto com as pessoas do convivio, as pessoas da comunidade e os locais do convivio
- * @throws java.io.IOException
- * @throws java.lang.ClassNotFoundException
- */
- public ArrayList<User> Load_Users() throws IOException, ClassNotFoundException{
- ArrayList<User> lista_users = null;
- try {
- iS = new ObjectInputStream(new FileInputStream("Lista Users.txt"));
- lista_users = (ArrayList<User>) iS.readObject();
- iS.close();
- } catch (IOException ex) {
- System.out.println("\nErro: "+ex);
- }
- return lista_users;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement