Two Laptop Bag*
The moose likes I/O and Streams and the fly likes writing data at a particular postion in a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "writing data at a particular postion in a file" Watch "writing data at a particular postion in a file" New topic
Author

writing data at a particular postion in a file

Sayali Basole
Greenhorn

Joined: Mar 15, 2013
Posts: 1


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

Joined: Feb 26, 2013
Posts: 158
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

Joined: Aug 07, 2007
Posts: 2172
    
  47
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 .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: writing data at a particular postion in a file
 
Similar Threads
Using Hadoop to process large text files along with CSV
retrieve a file from a fileinputstream
Get line number from text file.
can we change font or size of a particular column in jtable
Problem in renameTo() method