seeking and writing to a file
posted 15 years ago
I am familiar with the file io in java, but it seems like I have some holes in my understanding that I would greatly appreciate being filled if possible. Now the way I see it you have to use the randomaccessFile class to seek anywhere in a file, but you only hacve very simple write methods associated with that class, white char, writeUTF, what if you want to write a string at a time in ascii format. for exmple I am writing to a log file over and over again and need to write a string at a time, when I use the writeUTF method and view the file in notepad it adds a bunch of stuff I don't want, the same happens when I write char by char. Now when I ust the filewriter class to write a string at a time it works great, but I just overwrite the first line of the file each time. Any help/tips appreciated.