If rd
is of type BufferedReader
there is no way to figure out if readLine()
returned something that ended with \n
, \r
or \r\n
… the end-of-line characters are discarded and not part of the returned string.
If you really care about these characters, you can’t go through readLine()
. You’ll have to for instance read the characters one by one through read()
.