com.intellij.openapi.util.io.FileUtil.loadLines()方法的使用及代码示例

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

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

FileUtil.loadLines介绍

暂无

代码示例

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

private void doConverterTest() {
 try {
  List<String> lines = FileUtil.loadLines(getTestDataPath() + "/" + getTestName(true) + "_source.txt");
  assertSameLinesWithFile(getTestDataPath() + "/" + getTestName(true) + "_after.txt", new GoCommentsConverter().textToHtml(lines));
 }
 catch (IOException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

protected void doTest() {
 Executor executor = new DefaultRunExecutor();
 GoTestRunConfiguration runConfig = new GoTestRunConfiguration(myFixture.getProject(), "", GoTestRunConfigurationType.getInstance());
 runConfig.setTestFramework(getTestFramework());
 GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(runConfig, executor);
 GoTestEventsConverterBase converter =
  (GoTestEventsConverterBase)consoleProperties.createTestEventsConverter("gotest", consoleProperties);
 LoggingServiceMessageVisitor serviceMessageVisitor = new LoggingServiceMessageVisitor();
 try {
  for (String line : FileUtil.loadLines(new File(getTestDataPath(), getTestName(true) + ".txt"), CharsetToolkit.UTF8)) {
   converter.processServiceMessages(line + "\n", ProcessOutputTypes.STDOUT, serviceMessageVisitor);
  }
 }
 catch (IOException | ParseException e) {
  throw new RuntimeException(e);
 }
 ((OutputToGeneralTestEventsConverter)converter).flushBufferBeforeTerminating();
 Disposer.dispose((OutputToGeneralTestEventsConverter)converter);
 assertSameLinesWithFile(getTestDataPath() + "/" + getTestName(true) + "-expected.txt", serviceMessageVisitor.getLog());
}

代码示例来源:origin: neueda/jetbrains-plugin-graph-database-support

private static synchronized void cleanupNeo4jKnownHosts(Neo4jServerLoader neo4jServerLoader) {
    File hostsFile = Config.defaultConfig().trustStrategy().certFile();
    try {
      if (hostsFile != null && hostsFile.isFile()) {
        List<String> lines = FileUtil.loadLines(hostsFile);
        List<String> updatedLines = lines.stream()
              .filter((line) -> !line.startsWith(neo4jServerLoader.getBoltHost() + ":" + neo4jServerLoader.getBoltPort()))
              .filter((line) -> !line.isEmpty())
              .collect(Collectors.toList());
        FileUtil.writeToFile(hostsFile, String.join(System.lineSeparator(), updatedLines) + System.lineSeparator());
      }
    } catch (Exception e) {
      Throwables.throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

相关文章