hudson.util.IOUtils.copy()方法的使用及代码示例

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

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

IOUtils.copy介绍

暂无

代码示例

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

private void unzip(File dir, InputStream in) throws IOException {
  File tmpFile = File.createTempFile("tmpzip", null); // uses java.io.tmpdir
  try {
    // TODO why does this not simply use ZipInputStream?
    IOUtils.copy(in, tmpFile);
    unzip(dir,tmpFile);
  }
  finally {
    tmpFile.delete();
  }
}

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

/**
 * Writes {@code config.xml} to the specified output stream.
 * The user must have at least {@link #EXTENDED_READ}.
 * If he lacks {@link #CONFIGURE}, then any {@link Secret}s detected will be masked out.
 */
@Restricted(NoExternalUse.class)
public void writeConfigDotXml(OutputStream os) throws IOException {
  checkPermission(EXTENDED_READ);
  XmlFile configFile = getConfigFile();
  if (hasPermission(CONFIGURE)) {
    IOUtils.copy(configFile.getFile(), os);
  } else {
    String encoding = configFile.sniffEncoding();
    String xml = FileUtils.readFileToString(configFile.getFile(), encoding);
    Matcher matcher = SECRET_PATTERN.matcher(xml);
    StringBuffer cleanXml = new StringBuffer();
    while (matcher.find()) {
      if (Secret.decrypt(matcher.group(1)) != null) {
        matcher.appendReplacement(cleanXml, ">********<");
      }
    }
    matcher.appendTail(cleanXml);
    org.apache.commons.io.IOUtils.write(cleanXml.toString(), os, encoding);
  }
}

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

IOUtils.copy(input, writing(f));

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

new FilePath(f).symlinkTo(te.getLinkName(), TaskListener.NULL);
} else {
  IOUtils.copy(t, f);

代码示例来源:origin: jenkinsci/selenium-plugin

public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
    File out = new File(f, outputFileName);
    if (out.exists()) {
      out.delete();
    }
    IOUtils.copy(is, out);
    return out.getAbsolutePath();
  }
});

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

private void unzip(File dir, InputStream in) throws IOException {
  File tmpFile = File.createTempFile("tmpzip", null); // uses java.io.tmpdir
  try {
    // TODO why does this not simply use ZipInputStream?
    IOUtils.copy(in, tmpFile);
    unzip(dir,tmpFile);
  }
  finally {
    tmpFile.delete();
  }
}

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

/**
 * Drains the input stream and closes it.
 */
public static void drain(InputStream in) throws IOException {
  copy(in,new NullStream());
  in.close();
}

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

public static void copy(InputStream in, File out) throws IOException {
  FileOutputStream fos = new FileOutputStream(out);
  try {
    copy(in,fos);
  } finally {
    closeQuietly(fos);
  }
}

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

public static void copy(InputStream in, File out) throws IOException {
  FileOutputStream fos = new FileOutputStream(out);
  try {
    copy(in, fos);
  } finally {
    closeQuietly(fos);
  }
}

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

public static void copy(InputStream in, File out) throws IOException {
  FileOutputStream fos = new FileOutputStream(out);
  try {
    copy(in,fos);
  } finally {
    closeQuietly(fos);
  }
}

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

public static void copy(File src, OutputStream out) throws IOException {
  FileInputStream in = new FileInputStream(src);
  try {
    copy(in,out);
  } finally {
    closeQuietly(in);
  }
}

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

public static void copy(File src, OutputStream out) throws IOException {
  FileInputStream in = new FileInputStream(src);
  try {
    copy(in, out);
  } finally {
    closeQuietly(in);
  }
}

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

/**
 * Drains the input stream and closes it.
 */
public static void drain(InputStream in) throws IOException {
  copy(in,new NullStream());
  in.close();
}

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

public static void copy(File src, OutputStream out) throws IOException {
  FileInputStream in = new FileInputStream(src);
  try {
    copy(in,out);
  } finally {
    closeQuietly(in);
  }
}

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

/**
 * Drains the input stream and closes it.
 */
public static void drain(InputStream in) throws IOException {
  copy(in, new NullStream());
  in.close();
}

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

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  String path = req.getServletPath();
  String d = Util.getDigestOf(path);
  File cache = new File(cacheFolder, d);
  if(!cache.exists()) {
    URL url = new URL("http://hudson-ci.org/" + path);
    FileUtils.copyURLToFile(url,cache);
  }
  resp.setContentType(getMimeType(path));
  IOUtils.copy(cache,resp.getOutputStream());
}

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  String path = req.getServletPath();
  String d = Util.getDigestOf(path);
  File cache = new File(cacheFolder, d);
  if (!cache.exists()) {
    URL url = new URL("http://hudson-ci.org/" + path);
    FileUtils.copyURLToFile(url, cache);
  }
  resp.setContentType(getMimeType(path));
  IOUtils.copy(cache, resp.getOutputStream());
}

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

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  String path = req.getServletPath();
  String d = Util.getDigestOf(path);
  File cache = new File(cacheFolder, d);
  if(!cache.exists()) {
    URL url = new URL("http://hudson-ci.org/" + path);
    FileUtils.copyURLToFile(url,cache);
  }
  resp.setContentType(getMimeType(path));
  IOUtils.copy(cache,resp.getOutputStream());
}

代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-job

@edu.umd.cs.findbugs.annotations.SuppressWarnings("DM_DEFAULT_ENCODING")
public void doIndex(StaplerResponse rsp) throws IOException {
  Process p = new ProcessBuilder("dot", "-Tpng").start();
  writeDot(new PrintWriter(p.getOutputStream()));
  rsp.setContentType("image/png");
  IOUtils.copy(p.getInputStream(), rsp.getOutputStream());
}

代码示例来源:origin: uber/phabricator-jenkins-plugin

private TestResult getTestResult() throws IOException {
    File temp = File.createTempFile("anything", "xml");
    temp.deleteOnExit();
    InputStream junit = getClass().getResourceAsStream("go-torch-junit.xml");

    IOUtils.copy(junit, temp);
    TestResult result = new TestResult();
    result.parse(temp);
    return result;
  }
}

相关文章