Skip to content

Commit 7a142c9

Browse files
authored
Use a CachingOutputStream when using the build context (#64)
The CachingOutputStream provides a write cache so that the target file is only modified if there's a content change. If the data written exactly maps the existing content of the file, the file will not be modified at all.
1 parent e67ab9f commit 7a142c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/codehaus/plexus/build/DefaultBuildContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import org.codehaus.plexus.util.DirectoryScanner;
2828
import org.codehaus.plexus.util.Scanner;
29+
import org.codehaus.plexus.util.io.CachingOutputStream;
2930
import org.slf4j.Logger;
3031
import org.slf4j.LoggerFactory;
3132

@@ -76,7 +77,7 @@ public boolean hasDelta(List<String> relpaths) {
7677

7778
/** {@inheritDoc} */
7879
public OutputStream newFileOutputStream(File file) throws IOException {
79-
return Files.newOutputStream(file.toPath());
80+
return new CachingOutputStream(file.toPath());
8081
}
8182

8283
/** {@inheritDoc} */

0 commit comments

Comments
 (0)