In a java program, I am copying some text line-by-line into a string variable.
And then writing that data (again as text is retrieved line by line) into a second text file, using Files.newBufferedWriter
For some reason, the writing stops at a specific line # and col # in the second file-even though there are many more lines of text to be written. I even tried outputting messages to logs that writing is taking place at line # -- and the messages continue beyond line #892, till line #1098-- but the data is written only till line #892 in the second file.
AFAIK BufferedWriter can write data to large files- then why is this happening in my program?
For reference, the code snippets showing writing of data are given below-
BufferedWriter writer;
if(outputmode.equalsIgnoreCase("append"))
writer = Files.newBufferedWriter(path_target, ENCODING, StandardOpenOption.APPEND);
else if(outputmode.equalsIgnoreCase("overwrite"))
writer = Files.newBufferedWriter(path_target, ENCODING, StandardOpenOption.CREATE);
And the actual code writing text (in string variable "currentline") to the file is as shown below--
writer.write(currentline);
writer.newLine();
How do I solve this problem?