1 package org.codehaus.plexus.util.io;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.io.File;
20 import java.io.IOException;
21 import java.io.OutputStreamWriter;
22 import java.nio.charset.Charset;
23 import java.nio.file.Path;
24 import java.util.Objects;
25
26
27
28
29
30 public class CachingWriter extends OutputStreamWriter {
31 private final CachingOutputStream cos;
32
33 public CachingWriter(File path, Charset charset) throws IOException {
34 this(Objects.requireNonNull(path).toPath(), charset);
35 }
36
37 public CachingWriter(Path path, Charset charset) throws IOException {
38 this(path, charset, 32 * 1024);
39 }
40
41 public CachingWriter(Path path, Charset charset, int bufferSize) throws IOException {
42 this(new CachingOutputStream(path, bufferSize), charset);
43 }
44
45 private CachingWriter(CachingOutputStream outputStream, Charset charset) throws IOException {
46 super(outputStream, charset);
47 this.cos = outputStream;
48 }
49
50 public boolean isModified() {
51 return cos.isModified();
52 }
53 }