[Java: memorandum] Until the line feed code CRLF is changed to LF

Overview

Change the line feed code of a certain file? Program for.

The original file is CRLF, but I wanted it to be LF only. The character code is UTF-8 for both input and output.

environment

OS:Windows8.1 Pro Java Version: jre1.8

Prerequisites

See this article for file input / output.

program


//At the end of the record\Grant LF.
while ( ( msg = br.readLine()) != null ) {
    bf.append(msg);
    bf.append("\n");
}

Supplementary explanation

Recommended Posts

[Java: memorandum] Until the line feed code CRLF is changed to LF
A memorandum to clean up the code Ruby
How to specify character code and line feed code in JAXB
How to set character code and line feed code in Eclipse
A memorandum to reach the itchy place for Java Gold
[Java] Code that is hard to notice but terribly slow
How to apply C code format from the command line
[Windows] Java code is garbled
Java is the 5th day
Input to the Java console
[Java Servlet] Senri no Michi is one step to the second
Convert line feed code to html line feed tag with Thymeleaf and output
Java Converts disparate character codes to the same character code at once
To use the "java" command line tool ... How to avoid popping up
The milliseconds to set in /lib/calendars.properties of Java jre is UTC
Sample code to call the Yahoo! Local Search API in Java
How to increment the value of Map in one line in Java