This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes seeking and writing to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "seeking and writing to a file" Watch "seeking and writing to a file" New topic
Author

seeking and writing to a file

jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
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.
jesse
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: seeking and writing to a file