当前位置: 首页>>代码示例>>Java>>正文


Java MoreFiles.deleteRecursively方法代码示例

本文整理汇总了Java中com.google.common.io.MoreFiles.deleteRecursively方法的典型用法代码示例。如果您正苦于以下问题:Java MoreFiles.deleteRecursively方法的具体用法?Java MoreFiles.deleteRecursively怎么用?Java MoreFiles.deleteRecursively使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.io.MoreFiles的用法示例。


在下文中一共展示了MoreFiles.deleteRecursively方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: installApplication

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
@Override
public void installApplication(Path ipaOrAppPath) throws IosDeviceException {
  try {
    if (Files.isDirectory(ipaOrAppPath)) {
      await(simctl.install(ipaOrAppPath.toString()));
    } else {
      Path tmpDir = Files.createTempDirectory("app");
      try {
        unzipFile(ipaOrAppPath, tmpDir);
        Path appPath =
            tmpDir
                .resolve("Payload")
                .resolve(MoreFiles.getNameWithoutExtension(ipaOrAppPath) + ".app");
        await(simctl.install(appPath.toString()));
      } finally {
        MoreFiles.deleteRecursively(tmpDir, RecursiveDeleteOption.ALLOW_INSECURE);
      }
    }
  } catch (IOException e) {
    throw new IosDeviceException(this, e);
  }
}
 
开发者ID:google,项目名称:ios-device-control,代码行数:23,代码来源:SimulatorDeviceImpl.java

示例2: cleanUp

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
@After
public void cleanUp() throws Exception {
    appContext.stopLogging();
    DataStore.closeConnection(dbconn);
    try {
        MoreFiles
            .deleteRecursively(Paths.get(DataStore.getDbDir(testDbName)), RecursiveDeleteOption.ALLOW_INSECURE);
    } catch (IOException e) {
        // DONT make test failure.
        System.err.println("test db clean-up failure, remove manually later :P");
        e.printStackTrace();
    }
}
 
开发者ID:SecureSkyTechnology,项目名称:burpextender-proxyhistory-webui,代码行数:14,代码来源:AppContextTest.java

示例3: close

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
@Override
public void close() {
    try {
        MoreFiles.deleteRecursively(fProjectPath);
    } catch (IOException e) {
    }
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:8,代码来源:StubProject.java

示例4: stopService

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
private void stopService() {
    try {
        brokerService.stop();
        MoreFiles.deleteRecursively(tempDir.toPath(), RecursiveDeleteOption.ALLOW_INSECURE);
        brokerService = null;
    } catch (Exception e) {
        throw new IllegalStateException("Could not stop broker", e);
    }
}
 
开发者ID:zapodot,项目名称:embedded-jms-junit,代码行数:10,代码来源:EmbeddedJmsRuleImpl.java

示例5: clearCrashLogs

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
@Override
public void clearCrashLogs() throws IosDeviceException {
  try {
    Path tempDir = Files.createTempDirectory("artifacts");
    try {
      idevice.crashreport(tempDir.toString());
    } finally {
      MoreFiles.deleteRecursively(tempDir, RecursiveDeleteOption.ALLOW_INSECURE);
    }
  } catch (IOException e) {
    throw new IosDeviceException(this, e);
  }
}
 
开发者ID:google,项目名称:ios-device-control,代码行数:14,代码来源:RealDeviceImpl.java

示例6: deleteRecursively

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
/**
 * Delete all the contents of a path recursively.
 *
 * <p>First we try to delete securely. In case the FileSystem doesn't support it,
 * delete it insecurely.
 */
public static void deleteRecursively(Path path) throws IOException {
  try {
    MoreFiles.deleteRecursively(path);
  } catch (InsecureRecursiveDeleteException ignore) {
    logger.warning(String.format("Secure delete not supported. Deleting '%s' insecurely.",
        path));
    MoreFiles.deleteRecursively(path, RecursiveDeleteOption.ALLOW_INSECURE);
  }
}
 
开发者ID:google,项目名称:copybara,代码行数:16,代码来源:FileUtil.java

示例7: reindexFromScratch

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
@Test
public void reindexFromScratch() throws Exception {
  setUpChange();

  MoreFiles.deleteRecursively(sitePaths.index_dir, RecursiveDeleteOption.ALLOW_INSECURE);
  Files.createDirectory(sitePaths.index_dir);
  assertServerStartupFails();

  runGerrit("reindex", "-d", sitePaths.site_path.toString(), "--show-stack-trace");
  assertReady(ChangeSchemaDefinitions.INSTANCE.getLatest().getVersion());

  try (ServerContext ctx = startServer()) {
    GerritApi gApi = ctx.getInjector().getInstance(GerritApi.class);
    // Query change index
    assertThat(gApi.changes().query("message:Test").get().stream().map(c -> c.changeId))
        .containsExactly(changeId);
    // Query account index
    assertThat(gApi.accounts().query("admin").get().stream().map(a -> a._accountId))
        .containsExactly(adminId.get());
    // Query group index
    assertThat(
            gApi.groups()
                .query("Group")
                .withOption(MEMBERS)
                .get()
                .stream()
                .flatMap(g -> g.members.stream())
                .map(a -> a._accountId))
        .containsExactly(adminId.get());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:32,代码来源:ReindexIT.java

示例8: createTestFiles

import com.google.common.io.MoreFiles; //导入方法依赖的package包/类
@Test
public void createTestFiles() throws SQLException, ClassNotFoundException, IOException {
    File genJavaDir = pathRelativeToProjectRoot("pom.xml", "../lsql-cli-tests/src/generated/java");
    if (genJavaDir.exists()) {
        MoreFiles.deleteRecursively(genJavaDir.toPath());
    }

    File genTSDir = pathRelativeToProjectRoot("pom.xml", "../lsql-cli-tests/src/generated/ts");
    if (genTSDir.exists()) {
        MoreFiles.deleteRecursively(genTSDir.toPath());
    }

    String url = "jdbc:h2:mem:" + UUID.randomUUID() + ";mode=postgresql";

    BasicDataSource ds = new BasicDataSource();
    ds.setUrl(url);
    ds.setDefaultAutoCommit(false);
    Connection connection = ds.getConnection();
    LSql lSql = new LSql(TestCliConfig.class, ConnectionProviders.fromInstance(connection));
    createTables(lSql);
    connection.close();

    String[] args = {
            "config:" + TestCliConfig.class.getCanonicalName(),
            "url:" + url,
            "user:",
            "password:",
            "sqlStatements:" + pathRelativeToProjectRoot("pom.xml", "./src/test/java/com/w11k/lsql/cli/tests"),
            "dto:" + pathRelativeToProjectRoot("pom.xml", "./src/test/java/com/w11k/lsql/cli/tests"),
            "package:" + TestCliConfig.class.getPackage().getName(),
            "di:guice",
            "outDirJava:" + genJavaDir.getAbsolutePath(),
            "outDirTypeScript:" + genTSDir.getAbsolutePath()
    };
    Main.main(args);
}
 
开发者ID:w11k,项目名称:lsql,代码行数:37,代码来源:TestCliProjectGenerationTest.java


注:本文中的com.google.common.io.MoreFiles.deleteRecursively方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。