in src/main/java/org/apache/commons/io/output/WriterOutputStream.java [186:214]
private static void checkIbmJdkWithBrokenUTF16(final Charset charset) {
if (!StandardCharsets.UTF_16.name().equals(charset.name())) {
return;
}
final String TEST_STRING_2 = "v\u00e9s";
final byte[] bytes = TEST_STRING_2.getBytes(charset);
final CharsetDecoder charsetDecoder2 = charset.newDecoder();
final ByteBuffer bb2 = ByteBuffer.allocate(16);
final CharBuffer cb2 = CharBuffer.allocate(TEST_STRING_2.length());
final int len = bytes.length;
for (int i = 0; i < len; i++) {
bb2.put(bytes[i]);
bb2.flip();
try {
charsetDecoder2.decode(bb2, cb2, i == len - 1);
} catch (final IllegalArgumentException e) {
throw new UnsupportedOperationException("UTF-16 requested when running on an IBM JDK with broken UTF-16 support. "
+ "Please find a JDK that supports UTF-16 if you intend to use UF-16 with WriterOutputStream");
}
bb2.compact();
}
cb2.rewind();
if (!TEST_STRING_2.equals(cb2.toString())) {
throw new UnsupportedOperationException("UTF-16 requested when running on an IBM JDK with broken UTF-16 support. "
+ "Please find a JDK that supports UTF-16 if you intend to use UF-16 with WriterOutputStream");
}
}