Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

writing to a file at a particular place  RSS feed

 
shield kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way in java to write some textual data in a text file at a particular position..say i want to write a string "xyz" at 10th line and 15th column
 
Campbell Ritchie
Sheriff
Posts: 53747
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably not.
You would have to create a StringBuilder[] (or maybe better a List<StringBuilder>) with the contents of the file in, then insert at the appropriate location.
Remember array and String insertion indices have 0 = 1st position.
 
shield kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alright campbell
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!