problem with writing new data into file
hello
again I have problem with writing data into file for recursive method
the problem is that this method doesn't write the new content in to file, keeps reading the old content of file it doesn't read the new content
Code:
static void Reordering_solution(FileWriter writer_rordering_out,File reordering){
try {
///////////////////////////////////////////////////////////////////////
// some commands///////////////////////////////////////////////
// writing into file//////////////////////////////////////////////
for (int g = 0; g < test_after_filling_ordering.size(); g++) {
writer_rordering_out.write(test_after_filling_ordering.get(g).toString());
writer_rordering_out.write("\r\n");}
writer_rordering_out.write("Empty");
writer_rordering_out.write("\r\n");
/////////////////////////////////////////////////////////
// close writing /////////////////////////////////////
writer_rordering_out.close();
//////////////////////////////////////////////
reading data written///////////////////////
//////////////////////////////////////////////
Scanner inFile_77= new Scanner(new FileInputStream(reordering));
BufferedReader reader_reordering_sub = new BufferedReader(new FileReader(reordering));
line_reodering = null;
line_reodering = reader_reordering_sub.readLine();
line_reodering=inFile_77.nextLine();
///////////////////////////////////////////////
//some command to get new data//////////
///////////////////////////////////////////////
// writing new data into file/////////////////
/////////////////////////////////////////////
File re= new File("reordering");
FileWriter writer_rodering_2 = new FileWriter("reordering");
while (inFile_77.hasNextLine()){
line_reodering=inFile_77.nextLine();
System.out.println(" the line is "+ line_reodering);
writer_rodering_2.write(line_reodering);
writer_rodering_2.write("\r\n");}
///////////////////////////////////////////////////////////////
// calling recursive method////////////////////////////
///////////////////////////////////////////////////////////
Reordering_solution(writer_rodering_2 ,re);
}
can you tell me what is the problem with writing the new data into file??
plzzzzzzz I'm waiting for replies
thanks