4545import java .nio .channels .ReadableByteChannel ;
4646import java .nio .channels .Selector ;
4747import java .nio .charset .Charset ;
48- import java .nio .charset .StandardCharsets ;
4948import java .nio .file .Files ;
5049import java .util .Arrays ;
5150import java .util .Collection ;
@@ -3829,15 +3828,11 @@ public static void writeLines(final Collection<?> lines, final String lineEnding
38293828 * an {@link OutputStream} line by line, using the specified character
38303829 * encoding and the specified line ending.
38313830 *
3832- * UTF-16 is written big-endian with no byte order mark.
3833- * For little endian, use UTF-16LE. For a BOM, write it to the stream
3834- * before calling this method.
3835- *
38363831 * @param lines the lines to write, null entries produce blank lines
38373832 * @param lineEnding the line separator to use, null is system default
38383833 * @param output the {@link OutputStream} to write to, not null, not closed
38393834 * @param charset the charset to use, null means platform default
3840- * @throws NullPointerException if output is null
3835+ * @throws NullPointerException if the output is null
38413836 * @throws IOException if an I/O error occurs
38423837 * @since 2.3
38433838 */
@@ -3849,11 +3844,7 @@ public static void writeLines(final Collection<?> lines, String lineEnding, fina
38493844 if (lineEnding == null ) {
38503845 lineEnding = System .lineSeparator ();
38513846 }
3852- Charset cs = Charsets .toCharset (charset );
3853- // don't write a BOM
3854- if (cs == StandardCharsets .UTF_16 ) {
3855- cs = StandardCharsets .UTF_16BE ;
3856- }
3847+ final Charset cs = Charsets .toCharset (charset );
38573848 final byte [] eolBytes = lineEnding .getBytes (cs );
38583849 for (final Object line : lines ) {
38593850 if (line != null ) {
0 commit comments