Write a huge array list (200000 entries) to a text file java -


i need write entries of arraylist of 200000 entries text file. have persisted want editable simple text file rather object dump. have used number of methods reason writes around 1/4 of list. have used filewriter, printstream, fileutils. cuts off t around 1/4. can please tell me if there error in implementation or understanding since huge list , not getting exception , lastly if can please provide me solution! apologize earlier way of asking without code. here codes have tried till now:

list<string> readlist;  writer writer = new bufferedwriter(new outputstreamwriter(new fileoutputstream("absolute/path/demotest.txt"), "utf-8"));          (string entry : readlist) {              writer.write(entry);             writer.write("\n");         }         writer.close(); 

next:

filewriter writer = new filewriter("absolute/path/demotest.txt");  (string entry : readlist) {              writer.write(entry);             writer.write("\n");         }         writer.close(); 

next:

printstream out = new printstream(new fileoutputstream("absolute/path/demotest.txt")); 

lastly:

fileutils.writelines(new file("absolute/path/demotest.txt"), readlist); 

so said there 200000 entries, 1/4 of total entries on output text file. if array like: 1
2
3
...
200000
output file shows like:
1
2
3
...
50000

try:

list<string> lines = // ... files.write(paths.get("output.txt"), lines, standardcharsets.utf_8); 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -