All pastes #269914 Raw Edit

Stuff

public text v1 · immutable
·published 2006-12-06 22:42 UTC
rendered paste body
 public void saveToFile()
    {
      try {
            fos= new FileOutputStream("database.txt"); //create output stream
            oos = new ObjectOutputStream(fos);  //create object writing to stream
            oos.writeObject(people); //serialie object
          } catch (FileNotFoundException e) 
          {
            e.printStackTrace();
          } catch (IOException e) 
          {
            e.printStackTrace();
          } 
          finally 
          {
            try 
            {
             if (oos != null) oos.close();
            } catch (IOException e) {}
            try
            {
             if (fos != null) fos.close();
            } catch (IOException e) {}
          }      
    }