Those Pesky End-of-Line Characters

Problem

You really want to know about end-of-line characters.

Solution

Use and in whatever combination makes sense.

Discussion

If you are reading text (or bytes containing ASCII characters) in line mode using the readLine( ) method, you’ll never see the end-of-line characters, and so won’t be cursed with having to figure out whether , , or appears at the end of each line. If you want that level of detail, you have to read the characters or bytes one at a time, using the readline methods. The only time I’ve found this necessary is in networking code, where some of the line-mode protocols assume that the line ending is r . Even here, though, you can still work in line mode. When writing, send a . When reading, use readLine( ) and you won’t have to deal with the characters.

outputSocket.print("HELO " + myName + "
");
String response = inputSocket.readLine(  );
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.231.194