Java EE 5 SDK

com.sun.appserv.management.util.misc
Class SafeSave

java.lang.Object
  extended by com.sun.appserv.management.util.misc.SafeSave

public final class SafeSave
extends Object

Utilities for performing a safe save involving a temp file


Method Summary
static File getTempFile(File baseFile)
          Reads a line, outputting an optional prompt first.
static void replaceWithNew(File origFile, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTempFile

public static File getTempFile(File baseFile)
                        throws IOException
Reads a line, outputting an optional prompt first. If the prompt is null then no prompt is printed.

Throws:
IOException

replaceWithNew

public static void replaceWithNew(File origFile,
                                  File newFile)
                           throws IOException
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.

Throws:
IOException

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.