APPEND data at a specific line within a file using RandomAccessFile
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ynoT_Tony
Posted On:   Wednesday, July 17, 2002 11:06 AM

I am trying to use RandomAccessFile. The problem that I am having is that the methods available : getFilePointer(), and seek() dont refer to a specific line on the file, but to a Byte position. I have tried to create a counter to determine at what line in my file the pointer is at. But, I cant tell what the corresponding Byte is to it. I use getFilePointer, but thats not at the next line. My file is basically a growing/shrinking html page with tags and everytime this file gets updates, the positions are messed up, so I dont know where to append the data. I do know at what line I want to append it to, but RandomAccessFile doesnt have that feature to seek() for a line rather than a byte position. If anyone can be of any help, please fe   More>>

I am trying to use RandomAccessFile. The problem that I am having is that the methods available : getFilePointer(), and seek() dont refer to a specific line on
the file, but to a Byte position. I have tried to create a counter to determine at what line in my file the pointer is at. But, I cant tell what the corresponding Byte is
to it. I use getFilePointer, but thats not at the next line. My file is basically a growing/shrinking html page with tags and everytime this file gets updates, the
positions are messed up, so I dont know where to append the data. I do know at what line I want to append it to, but RandomAccessFile doesnt have that
feature to seek() for a line rather than a byte position. If anyone can be of any help, please feel free. Thanks... Tony.

   <<Less
About | Sitemap | Contact