/**
* The parameter tempLocation is a location to place our temp file (copy of the target one)
* to be used in case we could not successfully write the new file.
*/
public void write(Object object, IPath location, IPath tempLocation) throws IOException {
SafeFileOutputStream file = null;
String tempPath = tempLocation == null ? null : tempLocation.toOSString();
try {
file = new SafeFileOutputStream(location.toOSString(), tempPath);
write(object, file);
} finally {
if (file != null)
file.close();
}
}