• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing data at a particular postion in a file

 
Sayali Basole
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I want to write a data in a .java file at a particular position.. I have tried with randaomAccessfile but it is not working. please give some proper suggestion
Thanks in advance
 
James X Peterson
Whizlabs Java Support
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sayali Basole,

first read complete java file in to a string and then by using conditions get the position where you want to write the data. write the data at that position and write the modified string in to the file.


Regards,
James
 
Tony Docherty
Bartender
Posts: 2991
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch,

Please TellTheDetails (← click) just saying it doesn't work doesn't make it easy for anyone to help you. Please explain what you have tried, what you expected to happen, what actually happened and post a SSCCE .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic