Carriage return and new line with Java and readLine()

后端 未结 3 712
挽巷
挽巷 2020-12-03 05:09

I am using the following code to establish a HTTP connection and read data:

con = (HttpURLConnection) new URL(\"http://stream.twitter.com/1/statuses/sample.j         


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-03 05:25

    From the javadocs:

    public String readLine() throws IOException
    

    Read 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.
    Returns:
    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
    Throws:
    IOException - If an I/O error occurs

提交回复
热议问题