com.thoughtworks.go.util.FileUtil.toFileURI()方法的使用及代码示例

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

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

FileUtil.toFileURI介绍

暂无

代码示例

代码示例来源:origin: gocd/gocd

public static String getRepoUrl(File repositoryRoot, String project) {
  String url = FileUtil.toFileURI(new File(repositoryRoot, project));
  return url.replaceAll(" ", "%20");
}

代码示例来源:origin: gocd/gocd

public String projectRepositoryUrl() {
  return FileUtil.toFileURI(gitRepo);
}

代码示例来源:origin: gocd/gocd

public String projectRepositoryUrl() {
  return FileUtil.toFileURI(remoteRepoDir.getAbsoluteFile());
}

代码示例来源:origin: gocd/gocd

public String repositoryUrl(String project) {
  return FileUtil.toFileURI(new File(tempRepo, project));
}

代码示例来源:origin: gocd/gocd

@Test
@RunIf(value = EnhancedOSChecker.class, arguments = {EnhancedOSChecker.WINDOWS})
public void shouldCreateFileURIForFileOnWindows() {
  assertThat(FileUtil.toFileURI(new File("c:\\foo")).startsWith("file:///c:/foo"), is(true));
  assertThat(FileUtil.toFileURI(new File("c:\\a dir with spaces\\foo")).startsWith("file:///c:/a%20dir%20with%20spaces/foo"), is(true));
}

代码示例来源:origin: gocd/gocd

@Test
@RunIf(value = EnhancedOSChecker.class, arguments = {DO_NOT_RUN_ON, WINDOWS})
public void shouldCreateFileURIForFile() {
  assertThat(FileUtil.toFileURI(new File("/var/lib/foo/")), is("file:///var/lib/foo"));
  assertThat(FileUtil.toFileURI(new File("/var/a dir with spaces/foo")), is("file:///var/a%20dir%20with%20spaces/foo"));
  assertThat(FileUtil.toFileURI(new File("/var/司徒空在此/foo")), is("file:///var/%E5%8F%B8%E5%BE%92%E7%A9%BA%E5%9C%A8%E6%AD%A4/foo"));
}

相关文章