Methods Summary |
---|
private static java.io.File | formTempName(java.lang.String baseName)
return( new File ( baseName + System.currentTimeMillis() + ".temp" ) );
|
public static java.io.File | getTempFile(java.io.File baseFile)Reads a line, outputting an optional prompt first. If the prompt is null
then no prompt is printed.
File tempFile = null;
while ( (tempFile = formTempName( baseFile.toString() ) ).exists() )
{
}
return( tempFile );
|
public static void | replaceWithNew(java.io.File origFile, java.io.File newFile)Replace the original file with the new file in a manner which will not result in data
loss, with the worst risk being that the original file will be left with a different
name.
final File origTemp = getTempFile( origFile );
origFile.renameTo( origTemp );
newFile.renameTo( origFile );
origTemp.delete();
|