Writing files

suggest change

Files can be written byte- and line-wise using the Files class

Path p2 = Paths.get("/home/testuser/File.txt");
List<String> lines = Arrays.asList(
    new String[]{"First line", "Second line", "Third line"});

Files.write(p2, lines);
Files.write(Path path, byte[] bytes)

Existing files will be overwritten, and nonexistent files will be created.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents