Package antlr
Class PreservingFileWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.OutputStreamWriter
-
- java.io.FileWriter
-
- antlr.PreservingFileWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public class PreservingFileWriter extends FileWriter
PreservingFileWriter only overwrites target if the new file is different. Mainly added in order to prevent big and unnecessary recompiles in C++ projects. I/O is buffered.
-
-
Constructor Summary
Constructors Constructor Description PreservingFileWriter(String file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the file and see if the actual target is different if so the target file is overwritten by the copy.-
Methods inherited from class java.io.OutputStreamWriter
append, append, flush, getEncoding, write, write, write
-
Methods inherited from class java.io.Writer
append, nullWriter, write, write
-
-
-
-
Constructor Detail
-
PreservingFileWriter
public PreservingFileWriter(String file) throws IOException
- Throws:
IOException
-
-
Method Detail
-
close
public void close() throws IOException
Close the file and see if the actual target is different if so the target file is overwritten by the copy. If not we do nothing- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStreamWriter
- Throws:
IOException
-
-