本文整理汇总了Java中org.h2.store.fs.FileUtils.tryDelete方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.tryDelete方法的具体用法?Java FileUtils.tryDelete怎么用?Java FileUtils.tryDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.h2.store.fs.FileUtils
的用法示例。
在下文中一共展示了FileUtils.tryDelete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteFile
import org.h2.store.fs.FileUtils; //导入方法依赖的package包/类
/**
* Delete the given file now. This will remove the reference from the list.
*
* @param ref the reference as returned by addFile
* @param fileName the file name
*/
public synchronized void deleteFile(Reference<?> ref, String fileName) {
if (ref != null) {
String f2 = refMap.remove(ref);
if (f2 != null) {
if (SysProperties.CHECK) {
if (fileName != null && !f2.equals(fileName)) {
DbException.throwInternalError("f2:" + f2 + " f:" + fileName);
}
}
fileName = f2;
}
}
if (fileName != null && FileUtils.exists(fileName)) {
try {
IOUtils.trace("TempFileDeleter.deleteFile", fileName, null);
FileUtils.tryDelete(fileName);
} catch (Exception e) {
// TODO log such errors?
}
}
}
示例2: deleteOldTempFiles
import org.h2.store.fs.FileUtils; //导入方法依赖的package包/类
private void deleteOldTempFiles() {
String path = FileUtils.getParent(databaseName);
for (String name : FileUtils.newDirectoryStream(path)) {
if (name.endsWith(Constants.SUFFIX_TEMP_FILE) &&
name.startsWith(databaseName)) {
// can't always delete the files, they may still be open
FileUtils.tryDelete(name);
}
}
}
示例3: process
import org.h2.store.fs.FileUtils; //导入方法依赖的package包/类
private static void process(String fileName, boolean quiet) {
if (FileUtils.isDirectory(fileName)) {
// only delete empty directories
FileUtils.tryDelete(fileName);
} else if (quiet || fileName.endsWith(Constants.SUFFIX_TEMP_FILE) ||
fileName.endsWith(Constants.SUFFIX_TRACE_FILE)) {
FileUtils.tryDelete(fileName);
} else {
FileUtils.delete(fileName);
}
}
示例4: processRemoveDir
import org.h2.store.fs.FileUtils; //导入方法依赖的package包/类
private void processRemoveDir(String param) {
String fileName = getFileName(param);
if (!readonly && FileUtils.exists(fileName)
&& FileUtils.isDirectory(fileName)
&& FileUtils.tryDelete(fileName)) {
reply(250, "Ok");
} else {
reply(500, "Failed");
}
}