hudson.FilePath._chmod()方法的使用及代码示例

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

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

FilePath._chmod介绍

[英]Run chmod via libc if we can, otherwise fall back to Ant.
[中]如果可以的话,通过libc运行chmod,否则就求助于Ant。

代码示例

代码示例来源:origin: jenkinsci/jenkins

int mode = te.getMode() & 0777;
if (mode != 0 && !Functions.isWindows()) // be defensive
  _chmod(f, mode);

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Reads from a tar stream and stores obtained files to the base dir.
 */
private static void readFromTar(String name, File baseDir, InputStream in) throws IOException {
  TarInputStream t = new TarInputStream(in);
  try {
    TarEntry te;
    while ((te = t.getNextEntry()) != null) {
      File f = new File(baseDir,te.getName());
      if(te.isDirectory()) {
        f.mkdirs();
      } else {
        File parent = f.getParentFile();
        if (parent != null) parent.mkdirs();
        IOUtils.copy(t,f);
        f.setLastModified(te.getModTime().getTime());
        int mode = te.getMode()&0777;
        if(mode!=0 && !Functions.isWindows()) // be defensive
          _chmod(f,mode);
      }
    }
  } catch(IOException e) {
    throw new IOException2("Failed to extract "+name,e);
  } finally {
    t.close();
  }
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Reads from a tar stream and stores obtained files to the base dir.
 */
private static void readFromTar(String name, File baseDir, InputStream in) throws IOException {
  TarInputStream t = new TarInputStream(in);
  try {
    TarEntry te;
    while ((te = t.getNextEntry()) != null) {
      File f = new File(baseDir,te.getName());
      if(te.isDirectory()) {
        f.mkdirs();
      } else {
        File parent = f.getParentFile();
        if (parent != null) parent.mkdirs();
        IOUtils.copy(t,f);
        f.setLastModified(te.getModTime().getTime());
        int mode = te.getMode()&0777;
        if(mode!=0 && !Functions.isWindows()) // be defensive
          _chmod(f,mode);
      }
    }
  } catch(IOException e) {
    throw new IOException2("Failed to extract "+name,e);
  } finally {
    t.close();
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

int mode = te.getMode() & 0777;
if (mode != 0 && !Functions.isWindows()) // be defensive
  _chmod(f, mode);

相关文章