Programing

[JAVA] BufferedStream 으로 readLine시 응답없음

mjune.kim 2020. 10. 2. 15:07

JAVA 에서 제공하는 high level APIs인 BufferedStream.readLine() 을 호출하는 경우,

Client 로부터 전달되는 패킷(데이터)에 개행문자가 포함이 되어있는지 확인해야 한다.

만약 데이터에 해당 문자가 포함되지 않는 경우 readLine 을 대신해 read를 사용해야 한다.

public String readLine() throws IOException

Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.