mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 16:36:56 +07:00
for "'Files.readString()' or 'Files.writeString()' can be used" inspection GitOrigin-RevId: 93824f7bf9dabf87675a750b7dbc846a91475732
15 lines
590 B
Java
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*/));
|
|
}
|
|
} |