Wednesday, 15 August 2012

java - How would i delete data from an external file? -


I have a format in an external file

  name telephone no mob address  

From Gui, I would like to delete a delete which is in the above format using my delete button.

I have completed the exporting method and wondering what is being removed will be similar, here is my code for export.

  {FileOutputStream file; Printstream out; Try {File = new FileOutputStream ("../files / example.buab", true); Out = new printstream (file); Out.println (txtname.getText ()); Out.println (txtnum.getText ()); Out.println (txtmob.getText ()); Out.println (txtadd1.getText ()); System.err.println (""); Out.close (); } Hold (exception e) {System.err.println ("error in writing file"); }}  

Do you really want to immediately remove the contact on file?

Normally you do something like this:

  1. Import file contents into your model, iaw list of contact items
  2. All your edits Apply model (change value, add contact, delete contact)
  3. Save your edits, overwrite iaw file with your model.

Too many, delete a line on a file ...


No comments:

Post a Comment