antlr
Class PreservingFileWriter

java.lang.Object
  |
  +--java.io.Writer
        |
        +--java.io.OutputStreamWriter
              |
              +--java.io.FileWriter
                    |
                    +--antlr.PreservingFileWriter

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.


Field Summary
protected  File target_file
           
protected  File tmp_file
           
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
PreservingFileWriter(String file)
           
 
Method Summary
 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
flush, getEncoding, write, write, write
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

target_file

protected File target_file

tmp_file

protected File tmp_file
Constructor Detail

PreservingFileWriter

public PreservingFileWriter(String file)
                     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

Overrides:
close in class OutputStreamWriter
IOException


Copyright 1999-2003 Oliver Zeigermann. All Rights Reserved.