• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write to a file in exact position?  RSS feed

 
Zhixiong Pan
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
I intend to modify and add data in my file of *.db .For example one of my requirement may be this : change the char of 'E' in position of 57th charactor counting from the file's beginning to char 'I'.For another example I want to add a string at the end of file with a length of 64.What output class should best fit my requirement?
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want a random access file.
http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html
 
Zhixiong Pan
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tony.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!