本文整理了Java中org.apache.hadoop.fs.FileUtil.setPermission()
方法的一些代码示例,展示了FileUtil.setPermission()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.setPermission()
方法的具体详情如下:
包路径:org.apache.hadoop.fs.FileUtil
类名称:FileUtil
方法名:setPermission
[英]Set permissions to the required value. Uses the java primitives instead of forking if group == other.
[中]将权限设置为所需的值。如果group==other,则使用java原语而不是forking。
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public void flush() throws IOException {
super.flush();
if (LOG.isDebugEnabled()) {
LOG.debug("Resetting permissions to '" + permissions + "'");
}
if (!Shell.WINDOWS) {
Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
permissions);
} else {
// FsPermission expects a 10-character string because of the leading
// directory indicator, i.e. "drwx------". The JDK toString method returns
// a 9-character string, so prepend a leading character.
FsPermission fsPermission = FsPermission.valueOf(
"-" + PosixFilePermissions.toString(permissions));
FileUtil.setPermission(file, fsPermission);
}
}
代码示例来源:origin: com.klarna/hiverunner
File newFolder(TemporaryFolder basedir, String folder) {
try {
File newFolder = basedir.newFolder(folder);
FileUtil.setPermission(newFolder, FsPermission.getDirDefault());
return newFolder;
} catch (IOException e) {
throw new IllegalStateException("Failed to create tmp dir: " + e.getMessage(), e);
}
}
代码示例来源:origin: klarna/HiveRunner
File newFolder(TemporaryFolder basedir, String folder) {
try {
File newFolder = basedir.newFolder(folder);
FileUtil.setPermission(newFolder, FsPermission.getDirDefault());
return newFolder;
} catch (IOException e) {
throw new IllegalStateException("Failed to create tmp dir: " + e.getMessage(), e);
}
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
@Override
public void flush() throws IOException {
super.flush();
if (!Shell.WINDOWS) {
Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
permissions);
} else {
// FsPermission expects a 10-character string because of the leading
// directory indicator, i.e. "drwx------". The JDK toString method returns
// a 9-character string, so prepend a leading character.
FsPermission fsPermission = FsPermission.valueOf(
"-" + PosixFilePermissions.toString(permissions));
FileUtil.setPermission(file, fsPermission);
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Override
public void flush() throws IOException {
super.flush();
if (!Shell.WINDOWS) {
Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
permissions);
} else {
// FsPermission expects a 10-character string because of the leading
// directory indicator, i.e. "drwx------". The JDK toString method returns
// a 9-character string, so prepend a leading character.
FsPermission fsPermission = FsPermission.valueOf(
"-" + PosixFilePermissions.toString(permissions));
FileUtil.setPermission(file, fsPermission);
}
}
代码示例来源:origin: io.hops/hadoop-common
@Override
public void flush() throws IOException {
super.flush();
if (LOG.isDebugEnabled()) {
LOG.debug("Resetting permissions to '" + permissions + "'");
}
if (!Shell.WINDOWS) {
Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
permissions);
} else {
// FsPermission expects a 10-character string because of the leading
// directory indicator, i.e. "drwx------". The JDK toString method returns
// a 9-character string, so prepend a leading character.
FsPermission fsPermission = FsPermission.valueOf(
"-" + PosixFilePermissions.toString(permissions));
FileUtil.setPermission(file, fsPermission);
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@Override
public void flush() throws IOException {
super.flush();
if (!Shell.WINDOWS) {
Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
permissions);
} else {
// FsPermission expects a 10-character string because of the leading
// directory indicator, i.e. "drwx------". The JDK toString method returns
// a 9-character string, so prepend a leading character.
FsPermission fsPermission = FsPermission.valueOf(
"-" + PosixFilePermissions.toString(permissions));
FileUtil.setPermission(file, fsPermission);
}
}
代码示例来源:origin: com.klarna/hiverunner
/**
* Drives the unit test.
*/
private void evaluateStatement(Object target, TemporaryFolder temporaryFolder, Statement base) throws Throwable {
container = null;
FileUtil.setPermission(temporaryFolder.getRoot(), FsPermission.getDirDefault());
try {
LOGGER.info("Setting up {} in {}", getName(), temporaryFolder.getRoot().getAbsolutePath());
container = createHiveServerContainer(target, temporaryFolder);
base.evaluate();
} finally {
tearDown();
}
}
代码示例来源:origin: klarna/HiveRunner
/**
* Drives the unit test.
*/
private void evaluateStatement(Object target, TemporaryFolder temporaryFolder, Statement base) throws Throwable {
container = null;
FileUtil.setPermission(temporaryFolder.getRoot(), FsPermission.getDirDefault());
try {
LOGGER.info("Setting up {} in {}", getName(), temporaryFolder.getRoot().getAbsolutePath());
container = createHiveServerContainer(target, temporaryFolder);
base.evaluate();
} finally {
tearDown();
}
}
内容来源于网络,如有侵权,请联系作者删除!