Newline character omitted while reading from buffer

前端 未结 6 2043
一个人的身影
一个人的身影 2021-01-11 16:22

I\'ve written the following code:

public class WriteToCharBuffer {

 public static void main(String[] args) {
  String text = \"This is the data to write in          


        
6条回答
  •  不知归路
    2021-01-11 17:22

    This is what the javadocs says for the readLine() method of class BufferedReader

     /**
     * 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.
     *
     * @return     A String containing the contents of the line, not including
     *             any line-termination characters, or null if the end of the
     *             stream has been reached
     *
     * @exception  IOException  If an I/O error occurs
     */
    

提交回复
热议问题