Skip to content

Commit 914ca79

Browse files
committed
Revert "[IO-414] Don't write a BOM on every (or any) line #492"
This reverts commit 33225fa.
1 parent 604e55e commit 914ca79

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ The <action> type attribute can be add,update,fix,remove.
7171
StreamIterator fails to close its internal Stream.
7272
</action>
7373
<action dev="ggregory" type="fix" issue="IO-814" due-to="Elliotte Rusty Harold, Gary Gregory">
74-
Don't throw UncheckedIOException #491.
75-
</action>
76-
<action dev="ggregory" type="fix" issue="IO-414" due-to="Elliotte Rusty Harold, Gary Gregory">
77-
Don't write a BOM on every (or any) line #492.
74+
Don't throw UncheckedIOException #491.
7875
</action>
7976
<!-- ADD -->
8077
<!-- UPDATE -->

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3828,11 +3828,10 @@ public static void writeLines(final Collection<?> lines, final String lineEnding
38283828
* Writes the {@link #toString()} value of each item in a collection to
38293829
* an {@link OutputStream} line by line, using the specified character
38303830
* encoding and the specified line ending.
3831-
* <p>
3831+
*
38323832
* UTF-16 is written big-endian with no byte order mark.
38333833
* For little endian, use UTF-16LE. For a BOM, write it to the stream
38343834
* before calling this method.
3835-
* </p>
38363835
*
38373836
* @param lines the lines to write, null entries produce blank lines
38383837
* @param lineEnding the line separator to use, null is system default
@@ -3843,14 +3842,14 @@ public static void writeLines(final Collection<?> lines, final String lineEnding
38433842
* @since 2.3
38443843
*/
38453844
public static void writeLines(final Collection<?> lines, String lineEnding, final OutputStream output,
3846-
final Charset charset) throws IOException {
3845+
final Charset charset) throws IOException {
38473846
if (lines == null) {
38483847
return;
38493848
}
38503849
if (lineEnding == null) {
38513850
lineEnding = System.lineSeparator();
38523851
}
3853-
Charset cs = StandardCharsets.UTF_16.equals(Charsets.toCharset(charset)) ? StandardCharsets.UTF_16 : StandardCharsets.UTF_16BE;
3852+
Charset cs = Charsets.toCharset(charset);
38543853
// don't write a BOM
38553854
if (cs == StandardCharsets.UTF_16) {
38563855
cs = StandardCharsets.UTF_16BE;

0 commit comments

Comments
 (0)