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

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

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

FilePath.read介绍

[英]Reads this file.
[中]读取此文件。

代码示例

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

@Override public InputStream open() throws IOException {
  try {
    return f.read();
  } catch (InterruptedException x) {
    throw new IOException(x);
  }
}
@Override public <V> V run(Callable<V,IOException> callable) throws IOException {

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

@Override
public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException {
  readFromTar(FilePath.this.getName(), dir, compression.extract(FilePath.this.read()));
  return null;
}
private static final long serialVersionUID = 1L;

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

public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException {
  store = (channel==null ? FilePath.localChannel :  channel).call(new CredentialsFilePathMasterToSlaveCallable());
  if (store.exists()) {
    try (InputStream istream = store.read()) {
      props.load(istream);
    }
  }
}

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

/**
 * When this {@link FilePath} represents a zip file, extracts that zip file.
 *
 * @param target
 *      Target directory to expand files to. All the necessary directories will be created.
 * @since 1.248
 * @see #unzipFrom(InputStream)
 */
public void unzip(final FilePath target) throws IOException, InterruptedException {
  // TODO: post release, re-unite two branches by introducing FileStreamCallable that resolves InputStream
  if (this.channel!=target.channel) {// local -> remote or remote->local
    final RemoteInputStream in = new RemoteInputStream(read(), Flag.GREEDY);
    target.act(new UnzipRemote(in));
  } else {// local -> local or remote->remote
    target.act(new UnzipLocal());
  }
}
private class UnzipRemote extends SecureFileCallable<Void> {

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

/**
 * When this {@link FilePath} represents a tar file, extracts that tar file.
 *
 * @param target
 *      Target directory to expand files to. All the necessary directories will be created.
 * @param compression
 *      Compression mode of this tar file.
 * @since 1.292
 * @see #untarFrom(InputStream, TarCompression)
 */
public void untar(final FilePath target, final TarCompression compression) throws IOException, InterruptedException {
  // TODO: post release, re-unite two branches by introducing FileStreamCallable that resolves InputStream
  if (this.channel!=target.channel) {// local -> remote or remote->local
    final RemoteInputStream in = new RemoteInputStream(read(), Flag.GREEDY);
    target.act(new UntarRemote(compression, in));
  } else {// local -> local or remote->remote
    target.act(new UntarLocal(compression));
  }
}
private class UntarRemote extends SecureFileCallable<Void> {

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

public Void invoke(File dir, VirtualChannel channel) throws IOException {
  unzip(dir,FilePath.this.read());
  return null;
}
private static final long serialVersionUID = 1L;

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

public InputStream getInputStream() throws IOException {
  InputStream stream = null;
  try {
    stream = file.read();
  } catch(InterruptedException e) {
    stream = null;
  }
  return stream;
}

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

/**
 * Reads this file into a string, by using the current system encoding.
 */
public String readToString() throws IOException, InterruptedException {
  try (InputStream in = read()) {
    return org.apache.commons.io.IOUtils.toString(in);
  }
}

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

@Override public InputStream open() throws IOException {
  try {
    return f.read();
  } catch (InterruptedException x) {
    throw (IOException) new IOException(x.toString()).initCause(x);
  }
}
@Override public <V> V run(Callable<V,IOException> callable) throws IOException {

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

/**
 * Reads this file into a string, by using the current system encoding.
 */
public String readToString() throws IOException {
  InputStream in = read();
  try {
    return IOUtils.toString(in);
  } finally {
    in.close();
  }
}

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

/**
 * Reads this file into a string, by using the current system encoding.
 */
public String readToString() throws IOException {
  InputStream in = read();
  try {
    return IOUtils.toString(in);
  } finally {
    in.close();
  }
}

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

/**
 * Reads this file into a string, by using the current system encoding.
 */
public String readToString() throws IOException {
  InputStream in = read();
  try {
    return IOUtils.toString(in);
  } finally {
    in.close();
  }
}

代码示例来源:origin: io.fabric8.pipeline/kubernetes-pipeline-devops-steps

private String readFile(String fileName) throws AbortException {
  try {
    try (InputStream is = workspace.child(fileName).read()) {
      return IOUtils.toString(is, Charsets.UTF_8);
    }
  } catch (Exception e) {
    throw new AbortException("Unable to read file " + fileName + ". " + e);
  }
}

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

public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException {
  store = (channel==null ? MasterComputer.localChannel :  channel).call(new Callable<FilePath, IOException>() {
    public FilePath call() throws IOException {
      File home = new File(System.getProperty("user.home"));
      return new FilePath(new File(home, ".hudson/cli-credentials"));
    }
  });
  if (store.exists()) {
    props.load(store.read());
  }
}

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

public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException {
  store = (channel == null ? MasterComputer.localChannel : channel).call(new Callable<FilePath, IOException>() {
    public FilePath call() throws IOException {
      File home = new File(System.getProperty("user.home"));
      return new FilePath(new File(home, ".hudson/cli-credentials"));
    }
  });
  if (store.exists()) {
    props.load(store.read());
  }
}

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

public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException {
  store = (channel==null ? MasterComputer.localChannel :  channel).call(new Callable<FilePath, IOException>() {
    public FilePath call() throws IOException {
      File home = new File(System.getProperty("user.home"));
      return new FilePath(new File(home, ".hudson/cli-credentials"));
    }
  });
  if (store.exists()) {
    props.load(store.read());
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/publish-over

public byte[] readFileFromMaster(final String filePath) {
  final FilePath file = configDir.child(filePath);
  InputStream inputStream = null;
  try {
    inputStream = file.read();
    return IOUtils.toByteArray(inputStream);
  } catch (IOException ioe) {
    throw new BapPublisherException(Messages.exception_readFile(filePath, ioe.getLocalizedMessage()), ioe);
  } finally {
    IOUtils.closeQuietly(inputStream);
  }
}

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

public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException {
  readFromTar(FilePath.this.getName(),dir,compression.extract(FilePath.this.read()));
  return null;
}
private static final long serialVersionUID = 1L;

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

public Void invoke(File dir, VirtualChannel channel) throws IOException {
  readFromTar(FilePath.this.getName(), dir, compression.extract(FilePath.this.read()), nativeUtils);
  return null;
}
private static final long serialVersionUID = 1L;

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

public Void invoke(File dir, VirtualChannel channel) throws IOException {
  readFromTar(FilePath.this.getName(),dir,compression.extract(FilePath.this.read()));
  return null;
}
private static final long serialVersionUID = 1L;

相关文章