org.mule.runtime.core.api.util.FileUtils.renameFile()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.mule.runtime.core.api.util.FileUtils.renameFile()方法的一些代码示例,展示了FileUtils.renameFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.renameFile()方法的具体详情如下:
包路径:org.mule.runtime.core.api.util.FileUtils
类名称:FileUtils
方法名:renameFile

FileUtils.renameFile介绍

暂无

代码示例

代码示例来源:origin: mulesoft/mule

@Test
public void testRenameFileAcrossFolders() {
 try {
  File dir = createTestDir("test");
  File sourceFile = createTestFile("source");
  File destFile = new File(dir, "dest");
  assertTrue(FileUtils.renameFile(sourceFile, destFile));
  assertTrue(destFile.exists());
  assertTrue(destFile.delete());
  assertTrue(dir.delete());
 } catch (Exception e) {
  fail(e.getMessage());
 }
}

代码示例来源:origin: mulesoft/mule

@Test
public void testRenameFile() {
 try {
  File sourceFile = createTestFile("source");
  File destFile = createTestFile("dest");
  assertTrue(destFile.delete());
  assertTrue(FileUtils.renameFile(sourceFile, destFile));
  assertTrue(destFile.exists());
  assertTrue(destFile.delete());
 } catch (Exception e) {
  fail(e.getMessage());
 }
}

代码示例来源:origin: org.mule.runtime/mule-core

public static boolean renameFile(String srcFilePath, String destFilePath) {
 if (StringUtils.isNotBlank(srcFilePath) && StringUtils.isNotBlank(destFilePath)) {
  return renameFile(new File(srcFilePath), new File(destFilePath));
 } else {
  return false;
 }
}

代码示例来源:origin: org.mule.runtime/mule-core

public static void appendJarFileEntries(File jarFile, LinkedHashMap entries) throws Exception {
 if (entries != null) {
  LinkedHashMap combinedEntries = readJarFileEntries(jarFile);
  combinedEntries.putAll(entries);
  File tmpJarFile = File.createTempFile(jarFile.getName(), null);
  createJarFileEntries(tmpJarFile, combinedEntries);
  jarFile.delete();
  FileUtils.renameFile(tmpJarFile, jarFile);
 }
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void testRenameFileAcrossFolders() {
 try {
  File dir = createTestDir("test");
  File sourceFile = createTestFile("source");
  File destFile = new File(dir, "dest");
  assertTrue(FileUtils.renameFile(sourceFile, destFile));
  assertTrue(destFile.exists());
  assertTrue(destFile.delete());
  assertTrue(dir.delete());
 } catch (Exception e) {
  fail(e.getMessage());
 }
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void testRenameFile() {
 try {
  File sourceFile = createTestFile("source");
  File destFile = createTestFile("dest");
  assertTrue(destFile.delete());
  assertTrue(FileUtils.renameFile(sourceFile, destFile));
  assertTrue(destFile.exists());
  assertTrue(destFile.delete());
 } catch (Exception e) {
  fail(e.getMessage());
 }
}

相关文章