java - OpenCSV does not write all records -


i have written method in java updating text file delimited tab. i'm using opencsv library. first i'm reading in existing file, change values of columns , overwrite file. i'm running windows 7. problem not gets written file. if don't change value , overwrite file, not records written.

my code following. wrong it?

 private void csvwrite(int[] boundary, string filename, int answercount) {         csvreader csvreader = null;         list<string[]> csvbody = null;         try {             csvreader = new csvreader(new filereader(path + file),'\t');             csvbody = csvreader.readall();         } catch (ioexception e) {             e.printstacktrace();         }          // search file         int count = 0;         (string[] str : csvbody) {             if (str[0].equals(filename)) {                 // found                 csvbody.get(count)[pos_start_index+answercount-2] = arrays.tostring(boundary);                 break;             }             count++;         }          try {             csvreader.close();             csvwriter writer = new csvwriter(new filewriter(path + file),'\t');             writer.writeall(csvbody);             writer.flush();             writer.close();         } catch (ioexception e) {             e.printstacktrace();         }     } 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -