1 package fr.inrae.agroclim.indicators.util;
2
3 import java.io.BufferedWriter;
4 import java.io.File;
5 import java.io.FileNotFoundException;
6 import java.io.FileOutputStream;
7 import java.io.OutputStreamWriter;
8 import java.nio.charset.StandardCharsets;
9 import java.nio.file.Path;
10
11
12
13
14
15
16 public class Utf8BufferedWriter extends BufferedWriter {
17
18
19
20
21
22
23
24 public Utf8BufferedWriter(final File file) throws FileNotFoundException {
25 super(new OutputStreamWriter(new FileOutputStream(file, true), StandardCharsets.UTF_8));
26 }
27
28
29
30
31
32
33
34 public Utf8BufferedWriter(final Path path) throws FileNotFoundException {
35 super(new OutputStreamWriter(new FileOutputStream(path.toFile(), false), StandardCharsets.UTF_8));
36 }
37
38
39
40
41
42
43
44 public Utf8BufferedWriter(final String fileName) throws FileNotFoundException {
45 super(new OutputStreamWriter(new FileOutputStream(new File(fileName), true), StandardCharsets.UTF_8));
46 }
47 }