Direct printing of strings in Java string
Every time I do something like
BufferedReader br = new BufferedReader(new FileReader(f));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
It will not be displayed one by one. Instead, it will lag for 2-3 seconds and then show everything at once. I have tried using sleep methods etc. How can I make it so that it takes time and goes through each one, and not just lag behind and spit it all out all the time?
+3
source to share
3 answers
Try sending strings to a list of arrays. See if the arralist contains each line. Then try iterating the list of arrays onto the website chunk by block.
BufferedReader br = new BufferedReader(new FileReader(f));
ArrayList<String> list = new ArrayList<String>();
String line;
while ((line = br.readLine()) != null) {
list.add(line);
}
br.close();
for(String one_line: list){
//send lines to website:
//sendLine(one_line);
}
0
source to share