K
kahiga
I have a concept java question on how java is able to return from the
blocking readLine() after reading in a line ending in \n (*nix) or \r\n
(Win) or \r (Mac); Specifically for an inputstream coming from the
network (socket). When you create a socket connection to another
Computer running UNIX, MAC or Windows how does java know what the line
separator character is.
The basic analysis I can think would be that once you call readLine()
which is a blocking IO process, the jvm simply keeps reading in
incoming characters from the network until it detects a \r\n (for
windows) and then returns with the string.
Now if the computer is a Mac with uses \r for EOL, how does java know
to stop waiting for the \n and just return the string, or am I
misunderstanding the process?
Any Ideas are welcomed.
blocking readLine() after reading in a line ending in \n (*nix) or \r\n
(Win) or \r (Mac); Specifically for an inputstream coming from the
network (socket). When you create a socket connection to another
Computer running UNIX, MAC or Windows how does java know what the line
separator character is.
The basic analysis I can think would be that once you call readLine()
which is a blocking IO process, the jvm simply keeps reading in
incoming characters from the network until it detects a \r\n (for
windows) and then returns with the string.
Now if the computer is a Mac with uses \r for EOL, how does java know
to stop waiting for the \n and just return the string, or am I
misunderstanding the process?
Any Ideas are welcomed.