本文整理了Java中org.apache.hadoop.hive.common.FileUtils.makeAbsolute()
方法的一些代码示例,展示了FileUtils.makeAbsolute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.makeAbsolute()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.common.FileUtils
类名称:FileUtils
方法名:makeAbsolute
暂无
代码示例来源:origin: apache/hive
private String coerce(String originalValue) {
if (originalValue == null || originalValue.isEmpty()) return originalValue;
try {
Path originalPath = new Path(originalValue);
Path absolutePath = FileUtils.makeAbsolute(LOCAL_FILE_SYSTEM, originalPath);
return absolutePath.toString();
} catch (IOException exception) {
LOG.warn(String.format("Unable to resolve 'java.io.tmpdir' for absolute path '%s'", originalValue));
return originalValue;
}
}
代码示例来源:origin: apache/hive
@Test
public void testRelativePathToAbsolutePath() throws IOException {
LocalFileSystem localFileSystem = new LocalFileSystem();
Path actualPath = FileUtils.makeAbsolute(localFileSystem, new Path("relative/path"));
Path expectedPath = new Path(localFileSystem.getWorkingDirectory(), "relative/path");
assertEquals(expectedPath.toString(), actualPath.toString());
Path absolutePath = new Path("/absolute/path");
Path unchangedPath = FileUtils.makeAbsolute(localFileSystem, new Path("/absolute/path"));
assertEquals(unchangedPath.toString(), absolutePath.toString());
}
代码示例来源:origin: org.apache.hive/hive-common
private String coerce(String originalValue) {
if (originalValue == null || originalValue.isEmpty()) return originalValue;
try {
Path originalPath = new Path(originalValue);
Path absolutePath = FileUtils.makeAbsolute(LOCAL_FILE_SYSTEM, originalPath);
return absolutePath.toString();
} catch (IOException exception) {
LOG.warn(String.format("Unable to resolve 'java.io.tmpdir' for absolute path '%s'", originalValue));
return originalValue;
}
}
内容来源于网络,如有侵权,请联系作者删除!