Skip to content Skip to sidebar Skip to footer

How To Add Strings To Text File?

I am trying to save each visited URL in a .txt file. It works fine, however, every new URL replaces the older one. 1) How do i add URL's (on top, Not bottom) ? 2) How do i add a o

Solution 1:

Open file in append mode

FileWriterfileWriter=newFileWriter (file,  true) ;

Use BufferedWriter, you are opening file each time when URL get accessed. Try to minimise disk i/O overhead.

Post a Comment for "How To Add Strings To Text File?"