how java indentifies a end of line in txt files -
how bufferedreader identify end of line in text file?
also, if have code:
bufferedreader buff= new bufferedreader(file); string line; line=buff.readline(); line=buff.readline(); does line have value of second line?
yes, long file has 2 lines. keep reading line line call readline until there no more lines. then, return null.
it identifies line ending looking for:
any 1 of line feed ('\n'), carriage return ('\r'), or carriage return followed linefeed. - javadoc
this way accounts how operating systems mark newline, lf, cr, or crlf. see: https://en.wikipedia.org/wiki/newline.
Comments
Post a Comment