简体   繁体   中英

Any existing java library to delete , edit , add certain line in a file with swing in Jmenu?

I am now using Fileutils to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM