MCPcopy Create free account
hub / github.com/annmuor/jnode / readFile

Method readFile

jnode-core/src/jnode/core/FileUtils.java:42–49  ·  view source on GitHub ↗

Читает весь файл в строку @param path путь к файлу @return строка с содержимым файла @throws IOException

(String path)

Source from the content-addressed store, hash-verified

40 * @throws IOException
41 */
42 public static String readFile(String path) throws IOException {
43 try (FileInputStream stream = new FileInputStream(new File(path))) {
44 FileChannel fc = stream.getChannel();
45 MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0,
46 fc.size());
47 return Charset.forName("UTF8").decode(bb).toString();
48 }
49 }
50
51 /**
52 * Замена File.renameTo

Callers 2

runCustomScriptMethod · 0.95
writeFileToEchoareaMethod · 0.95

Calls 2

decodeMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected