Class PreservingFileWriter
java.lang.Object
java.io.Writer
java.io.OutputStreamWriter
java.io.FileWriter
antlr.PreservingFileWriter
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 OutputStreamWriter
append, append, flush, getEncoding, write, write, write
Methods inherited from class Writer
append, nullWriter, write, write
-
Field Details
-
target_file
-
tmp_file
the file we intend to write to
-
-
Constructor Details
-
PreservingFileWriter
the tmp file we create at first- Throws:
IOException
-
-
Method Details
-
close
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
-