使用什么代替服务器的 BufferedReader

What to use instead of BufferedReader for server

有人告诉我 BufferedReader.readLine() 不是从 clientSocket 读取数据的合适方法,因为它将一行视为以 \n\r 结尾的字符串。但是,我的行结束符号是 \r\n。我应该使用什么代替缓冲 reader?

I was told that BufferedReader.readLine() is not a suitable method to read data from clientSocket, because it consideres a line as a String ending with \n or \r.

你被告知错了。请参阅 Javadoc。

However, my ending symbol for line is \r\n. What should I use insted of buffered reader?

除了 BufferedReader,您不需要任何东西。它会将其识别为行终止符。请参阅 Javadoc。

... if I get a line with \r or \n inside

没有这样的事情。