org.apache.hadoop.util.Shell.getGetPermissionCommand()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(140)

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

Shell.getGetPermissionCommand介绍

[英]Return a command to get permission information.
[中]

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
protected void stashOriginalFilePermissions() throws IOException {
 // save off permissions in case we need to
 // rewrite the keystore in flush()
 if (!Shell.WINDOWS) {
  Path path = Paths.get(file.getCanonicalPath());
  permissions = Files.getPosixFilePermissions(path);
 } else {
  // On Windows, the JDK does not support the POSIX file permission APIs.
  // Instead, we can do a winutils call and translate.
  String[] cmd = Shell.getGetPermissionCommand();
  String[] args = new String[cmd.length + 1];
  System.arraycopy(cmd, 0, args, 0, cmd.length);
  args[cmd.length] = file.getCanonicalPath();
  String out = Shell.execCommand(args);
  StringTokenizer t = new StringTokenizer(out, Shell.TOKEN_SEPARATOR_REGEX);
  // The winutils output consists of 10 characters because of the leading
  // directory indicator, i.e. "drwx------".  The JDK parsing method expects
  // a 9-character string, so remove the leading character.
  String permString = t.nextToken().substring(1);
  permissions = PosixFilePermissions.fromString(permString);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

try {
 String output = FileUtil.execCommand(new File(getPath().toUri()),
   Shell.getGetPermissionCommand());
 StringTokenizer t =
   new StringTokenizer(output, Shell.TOKEN_SEPARATOR_REGEX);

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Override
protected void stashOriginalFilePermissions() throws IOException {
 // save off permissions in case we need to
 // rewrite the keystore in flush()
 if (!Shell.WINDOWS) {
  Path path = Paths.get(file.getCanonicalPath());
  permissions = Files.getPosixFilePermissions(path);
 } else {
  // On Windows, the JDK does not support the POSIX file permission APIs.
  // Instead, we can do a winutils call and translate.
  String[] cmd = Shell.getGetPermissionCommand();
  String[] args = new String[cmd.length + 1];
  System.arraycopy(cmd, 0, args, 0, cmd.length);
  args[cmd.length] = file.getCanonicalPath();
  String out = Shell.execCommand(args);
  StringTokenizer t = new StringTokenizer(out, Shell.TOKEN_SEPARATOR_REGEX);
  // The winutils output consists of 10 characters because of the leading
  // directory indicator, i.e. "drwx------".  The JDK parsing method expects
  // a 9-character string, so remove the leading character.
  String permString = t.nextToken().substring(1);
  permissions = PosixFilePermissions.fromString(permString);
 }
}

代码示例来源:origin: io.hops/hadoop-common

@Override
protected void stashOriginalFilePermissions() throws IOException {
 // save off permissions in case we need to
 // rewrite the keystore in flush()
 if (!Shell.WINDOWS) {
  Path path = Paths.get(file.getCanonicalPath());
  permissions = Files.getPosixFilePermissions(path);
 } else {
  // On Windows, the JDK does not support the POSIX file permission APIs.
  // Instead, we can do a winutils call and translate.
  String[] cmd = Shell.getGetPermissionCommand();
  String[] args = new String[cmd.length + 1];
  System.arraycopy(cmd, 0, args, 0, cmd.length);
  args[cmd.length] = file.getCanonicalPath();
  String out = Shell.execCommand(args);
  StringTokenizer t = new StringTokenizer(out, Shell.TOKEN_SEPARATOR_REGEX);
  // The winutils output consists of 10 characters because of the leading
  // directory indicator, i.e. "drwx------".  The JDK parsing method expects
  // a 9-character string, so remove the leading character.
  String permString = t.nextToken().substring(1);
  permissions = PosixFilePermissions.fromString(permString);
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Override
protected void stashOriginalFilePermissions() throws IOException {
 // save off permissions in case we need to
 // rewrite the keystore in flush()
 if (!Shell.WINDOWS) {
  Path path = Paths.get(file.getCanonicalPath());
  permissions = Files.getPosixFilePermissions(path);
 } else {
  // On Windows, the JDK does not support the POSIX file permission APIs.
  // Instead, we can do a winutils call and translate.
  String[] cmd = Shell.getGetPermissionCommand();
  String[] args = new String[cmd.length + 1];
  System.arraycopy(cmd, 0, args, 0, cmd.length);
  args[cmd.length] = file.getCanonicalPath();
  String out = Shell.execCommand(args);
  StringTokenizer t = new StringTokenizer(out, Shell.TOKEN_SEPARATOR_REGEX);
  // The winutils output consists of 10 characters because of the leading
  // directory indicator, i.e. "drwx------".  The JDK parsing method expects
  // a 9-character string, so remove the leading character.
  String permString = t.nextToken().substring(1);
  permissions = PosixFilePermissions.fromString(permString);
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
protected void stashOriginalFilePermissions() throws IOException {
 // save off permissions in case we need to
 // rewrite the keystore in flush()
 if (!Shell.WINDOWS) {
  Path path = Paths.get(file.getCanonicalPath());
  permissions = Files.getPosixFilePermissions(path);
 } else {
  // On Windows, the JDK does not support the POSIX file permission APIs.
  // Instead, we can do a winutils call and translate.
  String[] cmd = Shell.getGetPermissionCommand();
  String[] args = new String[cmd.length + 1];
  System.arraycopy(cmd, 0, args, 0, cmd.length);
  args[cmd.length] = file.getCanonicalPath();
  String out = Shell.execCommand(args);
  StringTokenizer t = new StringTokenizer(out, Shell.TOKEN_SEPARATOR_REGEX);
  // The winutils output consists of 10 characters because of the leading
  // directory indicator, i.e. "drwx------".  The JDK parsing method expects
  // a 9-character string, so remove the leading character.
  String permString = t.nextToken().substring(1);
  permissions = PosixFilePermissions.fromString(permString);
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

try {
 String output = FileUtil.execCommand(new File(getPath().toUri()), 
   Shell.getGetPermissionCommand());
 StringTokenizer t =
   new StringTokenizer(output, Shell.TOKEN_SEPARATOR_REGEX);

代码示例来源:origin: io.hops/hadoop-common

try {
 String output = FileUtil.execCommand(new File(getPath().toUri()), 
   Shell.getGetPermissionCommand());
 StringTokenizer t =
   new StringTokenizer(output, Shell.TOKEN_SEPARATOR_REGEX);

代码示例来源:origin: ch.cern.hadoop/hadoop-common

try {
 String output = FileUtil.execCommand(new File(getPath().toUri()), 
   Shell.getGetPermissionCommand());
 StringTokenizer t =
   new StringTokenizer(output, Shell.TOKEN_SEPARATOR_REGEX);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

try {
 String output = FileUtil.execCommand(new File(getPath().toUri()), 
   Shell.getGetPermissionCommand());
 StringTokenizer t =
   new StringTokenizer(output, Shell.TOKEN_SEPARATOR_REGEX);

相关文章