Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedWriter;
- import java.io.IOException;
- import java.nio.charset.Charset;
- import java.nio.charset.StandardCharsets;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- class SomeClass {
- public static void main(final String[] args) throws IOException {
- final Path path = Paths.get("d:\\text.txt");
- final Charset charset = StandardCharsets.UTF_8;
- try (BufferedWriter w = Files.newBufferedWriter(path, charset)) {
- w.append("some string");
- }
- Files.lines(path, charset).forEach(System.out::println);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement