changing the file content

changing the file content

I have requirement like this, a file contain maximum 1000 lines. I want to cahnage the 501 line content. I know this logic , reading the file content and changeing the 501 line content and crating one more file and storing this changeing information

String line=null;
String fileContent=""

while((line.bufferedReader.readLine())!=null) {
         fileContent+="";
         // code for to chang the 501 line content.
}

// heare we are creating one more file

BuffredWriter br=new BufferedReader(new FileWriter("newfile.txt")); br.write(fileContent);

i know this logic . I want only one word in 501 line but it take lot of time to read all content of old file and storing in new file.

Please help me ,Is there any better logic to chang content in the file without creating new file?

View Answers

Ads









Related Tutorials/Questions & Answers:
changing the file content
changing the file content  I have requirement like this, a file... , reading the file content and changeing the 501 line content and crating one... in 501 line but it take lot of time to read all content of old file and storing
how to modify content of XML file
to xml file to replace "XYZ".Every time with the content of text box the file should...how to modify content of XML file  hi, I want to modify content of a xml file.There are two tags of similar name say <ContentName>C:\Myinfo
Advertisements
Java File content type
Java File content type In this section, you will learn how to get the content type of the specified file. Description of code: This is essential part of the file. In various applications, there is a use of content type. Here we
ModuleNotFoundError: No module named 'prometheus-file-content-exporter'
ModuleNotFoundError: No module named 'prometheus-file-content-exporter' ...: ModuleNotFoundError: No module named 'prometheus-file-content-exporter' How to remove the ModuleNotFoundError: No module named 'prometheus-file-content-exporter'
changing of data...
changing of data...  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have given 10 second.but once... is not changing in 10 second...what should i do..?? reply fast
changing of data...
servlet.database is not changing in 10 second  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have... this servlet.database is not changing in 10 second...what should i do..?? reply fast
changing of data...
data changing in 10 second  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have given 10 second.but... is not changing in 10 second...what should i do..?? reply fast
how to display the excel file content in the jsp
how to display the excel file content in the jsp  How to present the content of the newly created excel file in the following jsp to the web browser: print("code sample"); <%@ page import="java.io.InputStream" %>
Storing content from file path to an array
Storing content from file path to an array  Hi, I have a path... would like to access the "Animation.txt" file from this path and store the contents in this text file to an array. I am using jsp. I can access my path but how
iterate through map and write the content in a separate file
iterate through map and write the content in a separate file  I am trying to save the data from file to a map, then iterate through map and write... through the above file and save it in maps depending on if it is a concept
iterate through map and write the content in a separate file
iterate through map and write the content in a separate file  I am trying to save the data from file to a map, then iterate through map and write... through the above file and save it in maps depending on if it is a concept
iterate through map and write the content in a separate file
iterate through map and write the content in a separate file  I am trying to save the data from file to a map, then iterate through map and write... through the above file and save it in maps depending on if it is a concept
Write a program in Java to append content at the end of an already existing file.
Write a program in Java to append content at the end of an already existing file.  Write a program in Java to append content at the end of an already existing file
How to delete content of a log file from linux terminal?
How to delete content of a log file from linux terminal?  Hi, My... running queries. But first I want to delete the content of the /var/log/slow-queries.log file. Can anyone tell me how to do this? Thanks   Hi, Its
Changing pictures - Java Beginners
Changing pictures  I found some html code that allows pictures to be changed on a web page. I copied the code and saved it as an html file. when I... Explorer that have pictures changing on them and they do not get blocked? 
Changing MySQL Port Number
Changing MySQL Port Number  How to change the MySQL port no in windows.   Hi, Open the my.ini file present in the MySQL server... to the desired port number. After making change in my.ini file save the file
changing uiview background color
changing uiview background color  changing UIView background color in ios   self.view.backgroundColor = [UIColor colorWithRed:244.0f/255.0f green:230.0f/255.0f blue:183.0f/255.0f alpha:1.0f
Changing root Password
Changing root Password  how do i change the root password in mysql
How to copy many files into one file and how to manage the content of the final file?
How to copy many files into one file and how to manage the content of the final file?  Hi, i'm trying to code that copy the content of all txt file... is it possible to put the content of each file below the other one ? Here is my
How to read content of JPEG file in Java?
Example of reading the content of JPEG file in Java Java JAI API helps... in the Java Program. In this article we will see how to read the JPEG image file. We will use the javax.imageio.ImageIO class for reading the image file data
Changing 2D graph using slider.
Changing 2D graph using slider.  Code for changing a 2d graph with help of slider
Show content of .vm file as output using Velocity
Show content of .vm file as output using Velocity  ... content of .vm file using velocity and also shows how to use Iterator......" in StringOutput.vm file, that message will be show as output.    
how to print the content of file in 2d matrix having same dimension as given in file(n*m).
how to print the content of file in 2d matrix having same dimension as given in file(n*m).   here is code: import java.io.File; import... IOException { Scanner s = new Scanner(new File("rfg.txt")); List list = new
changing selection color of <button>
changing selection color of   dear all, i have loaded image in border less button tag when button is selected with tab key i get brown color rectangle around image. how do i change color of that rectangle from brown to white
Change a file timestamp
C:\vinod\Math_package>javac ChangeFileDate.java C:\vinod\Math_package>java ChangeFileDate Change file timestamp example! Enter file name with extension: StrStartWith.shtml Enter last
Changing background color using JavaScript
Changing background color using JavaScript  Hi Sir Is there any way to change the background color using JavaScript ? Please mention code with your answer.   Hello Friend Pass the element & color in the given
changing Background Color
changing Background Color       In this program, we are going to tell you how you can change background color of a pdf file. You can change the background color
changing final Boolean value in SwingUtilities.invokeLater()
changing final Boolean value in SwingUtilities.invokeLater()  Hi, I have a problem with setting final Boolean value in second time. But it is necessary to me. Have You any Idea of this Scenario? Here is my code: public
changing primary key of parent table
changing primary key of parent table  I want to change one primary key from a table where primary key is auto created? How can I do that? I have tried UPDATE person SET personid=3494 WHERE personid=8483; and i get the following
How to design a changing color of the chameleon, changing color of the chameleon, color of the chameleon
How to design a changing color of the chameleon       Have you seen the chameleon to changing...; Save File: Now go to File menu > Save optimized. Final Result
How to Changing Toolbar Color using iPhone Application ?
How to Changing Toolbar Color using iPhone Application ?  Hi, i have developing a small application to changing the toolbar color in iphone. But i have facing the problem that color is not changing. Can somebody suggest me

Ads