Files
openide/java/java-tests/testData/inspection/filesReadWriteString/beforeReadString.java
Bas Leijdekkers 3573ea1de7 Java: smaller highlight in inspection
for "'Files.readString()' or 'Files.writeString()' can be used" inspection

GitOrigin-RevId: 93824f7bf9dabf87675a750b7dbc846a91475732
2022-07-20 18:53:36 +00:00

15 lines
590 B
Java

// "Fix all ''Files.readString()' or 'Files.writeString()' can be used' problems in file" "true"
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Example {
void testRead1() throws IOException {
String s = new String<caret>(Files.readAllBytes(Paths.get("/etc/passwd")), StandardCharsets.ISO_8859_1);
}
void testRead2() throws IOException {
String s = new /*3*/String(/*4*/Files/*5*/./*6*/readAllBytes(/*7*/Paths.get("/etc/passwd"))/*8*/, /*9*/(StandardCharsets./*1*/UTF_8/*2*/));
}
}