mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
23 lines
587 B
Java
23 lines
587 B
Java
import java.nio.charset.StandardCharsets;
|
|
|
|
// "Replace with 'StandardCharsets.UTF_16'" "true"
|
|
class Test {
|
|
void test(byte[] bytes) {
|
|
String string = null;
|
|
try {
|
|
try {
|
|
string = new String(bytes, StandardCharsets.UTF_16);
|
|
}
|
|
catch (Exception exception) {
|
|
System.out.println("ex1");
|
|
}
|
|
}
|
|
// this catch is already unnecessary, so don't remove it
|
|
catch (java.io.UnsupportedEncodingException exception) {
|
|
exception.printStackTrace();
|
|
}
|
|
if(string.startsWith("Foo")) {
|
|
System.out.println("It's a foo!");
|
|
}
|
|
}
|
|
} |