domingo, 22 de agosto de 2010

Guardar objeto en ArrayList

Este metodo puede servir para luego cargarlos, y mostrarlo en una tabla o como queramos.

   public static boolean guardar(ArrayList lista, File fichero) {
      try {
         ObjectOutputStream ficheroSalida = new ObjectOutputStream(new FileOutputStream(fichero));
         ficheroSalida.writeObject(lista);
         ficheroSalida.flush();
         ficheroSalida.close();
         return true;
      } catch (FileNotFoundException fnfe) {
         return false;
      } catch (IOException ioe) {
         return false;
      }
   }


El otro metodo de cargar os lo pongo aquí.

No hay comentarios:

Publicar un comentario