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
17
18
19 public class Utf8BufferedWriter extends BufferedWriter {
20
21
22
23
24
25
26
27 public Utf8BufferedWriter(final File file) throws FileNotFoundException {
28 super(new OutputStreamWriter(new FileOutputStream(file, true), StandardCharsets.UTF_8));
29 }
30
31
32
33
34
35
36
37 public Utf8BufferedWriter(final Path path) throws FileNotFoundException {
38 super(new OutputStreamWriter(new FileOutputStream(path.toFile(), false), StandardCharsets.UTF_8));
39 }
40
41
42
43
44
45
46
47 public Utf8BufferedWriter(final String fileName) throws FileNotFoundException {
48 super(new OutputStreamWriter(new FileOutputStream(new File(fileName), true), StandardCharsets.UTF_8));
49 }
50 }