There are several lines of code in the IO operation:
while (line = Bufferedreader.readline ())!=null) {
if (Line.length ()! = 0) {
Stringbuilder.append (line+ "\ r \ n");
}
}
Here the line break "\ r \ n" fails, replacing it with "\ n" is not possible, and finally replaced with the JDK's own cross-platform line delimiter, the program is rewritten as follows:
Stringbuilder.append (Line+system.getproperty (line.separator));
Problem solving.
In addition, "\ r \ n", \ r is the carriage return (return?) ), back to the beginning of the line, \ n is newline (next?) ), move the cursor to the same horizontal position of the next line.
The impression of the keyboard on the Enter is called carriage return, can be wrapped, Java programming language is not the case.
In Linux \ n contains a carriage return, Windows does not, the lack of control or the order of the wrong will be invalidated, of course, the reason for failure is more than two.
There is also a case where the row delimiter is invalid, and you can replace the two line breaks to try again. The reason may be that there is a difference between the server that the code is deployed on and the system that the user uses
For example, projects are often deployed on Linux, and most users are using Windows. "System.getproperty (Line.separator)" As a cross-platform delimiter,
Automatically gets the new line character under Linux \ n, which is invalidated under Windows. You need to change the cross-platform delimiter to \ r \ n, that is, consistent with the system used by the user.
Java:stringbuilder Append line break problem