Files
openide/java/java-tests/testData/inspection/charsetObjectCanBeUsed/beforeStringUEE2.java

22 lines
582 B
Java

// "Replace with 'StandardCharsets.UTF_16'" "true"
import java.io.UnsupportedEncodingException;
class Test {
static final String UTF16 = "UTF-16";
void test(byte[] bytes) {
String string = null;
String string2 = null;
try {
string = new String(bytes, UTF<caret>16);
string2 = new String(bytes, "UTF-8");
}
// catch is still necessary after the single replacement
catch (UnsupportedEncodingException exception) {
exception.printStackTrace();
}
if(string.startsWith("Foo")) {
System.out.println("It's a foo!");
}
}
}