Any existing java library to delete , edit , add certain line in a file with swing in Jmenu?
I am now using Fileutils t开发者_JS百科o access a file to retrieve lines of phone number.
But now I need to add phone number , delete phone number and edit phone number in the file. I do know how to do it with JMenu , but i keep wondering , do anyone create a library for this?
I would suggest you to go for DB .
FILE IO in such case is very ugly coding.
and then also if you want to do it.
to modify content you need to create other file read from older and modify it in memory and write it back to new file.
If you don't want to go for DB, which is the best idea, you should maybe. Read the whole file and store in a Collection then, you remove the phone number, and then write it again on file overwriting. It's definitely much more work. But it works too. Reminding that the class of the ObjectType needs to implements Serializible.
精彩评论