java - Fastest way to read a file line by line with 2 sets of Strings on each line? -
what fastest way can read line line each line containing 2 strings. example input file be:
fastest, way to, read one, file line, line .... can large file
there 2 sets of strings on each line need if there spaces between string e.g. "by line"
currently using
filereader = new filereader(file); bufferedreader br = new bufferedreader(a); string line; line = br.readline(); long b = system.currenttimemillis(); while(line != null){
is efficient enough or there more efficient way using standard java api (no outside libraries please) appreciated thanks!
it depends mean when "efficient." point of view of performance ok. if asking code style , size, pesonally small correction:
bufferedreader br = new bufferedreader(new filereader(file)); string line; while((line = br.readline()) != null) { // line. }
for reading stdin java 6 offers yet way. use class console , methods
readline()
, readline(fmt, object... args)
Comments
Post a Comment