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

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

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

FilePath.act介绍

[英]Executes some program on the machine that this FilePath exists, so that one can perform local file operations.
[中]在存在此文件路径的计算机上执行某些程序,以便可以执行本地文件操作。

代码示例

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

/**
 * Executes some program on the machine that this {@link FilePath} exists,
 * so that one can perform local file operations.
 */
public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
  return act(callable,callable.getClass().getClassLoader());
}

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

/**
 * Returns the number of usable bytes in the partition of that file.
 * @since 1.542
 */
public long getUsableDiskSpace() throws IOException, InterruptedException {
  return act(new GetUsableDiskSpace());
}
private static class GetUsableDiskSpace extends SecureFileCallable<Long> {

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

/**
 * Overwrites this file by placing the given String as the content.
 *
 * @param encoding
 *      Null to use the platform default encoding on the remote machine.
 * @since 1.105
 */
public void write(final String content, final String encoding) throws IOException, InterruptedException {
  act(new Write(encoding, content));
}
private class Write extends SecureFileCallable<Void> {

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

/**
 * Resolves symlink, if the given file is a symlink. Otherwise return null.
 * <p>
 * If the resolution fails, report an error.
 *
 * @since 1.456
 */
public String readLink() throws IOException, InterruptedException {
  return act(new ReadLink());
}
private class ReadLink extends SecureFileCallable<String> {

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

/**
 * Deletes this file.
 * @throws IOException if it exists but could not be successfully deleted
 * @return true, for a modicum of compatibility
 */
public boolean delete() throws IOException, InterruptedException {
  act(new Delete());
  return true;
}
private class Delete extends SecureFileCallable<Void> {

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

/**
 * Checks if the file exists.
 */
public boolean exists() throws IOException, InterruptedException {
  return act(new Exists());
}
private class Exists extends SecureFileCallable<Boolean> {

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

private void setLastModifiedIfPossible(final long timestamp) throws IOException, InterruptedException {
  String message = act(new SetLastModified(timestamp));
  if (message!=null) {
    LOGGER.warning(message);
  }
}
private class SetLastModified extends SecureFileCallable<String> {

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

/**
 * Returns the total number of bytes in the partition of that file.
 * @since 1.542
 */
public long getTotalDiskSpace() throws IOException, InterruptedException {
  return act(new GetTotalDiskSpace());
}
private static class GetTotalDiskSpace extends SecureFileCallable<Long> {

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

@Override public Collection<String> list(String includes, String excludes, boolean useDefaultExcludes) throws IOException {
  try {
    return f.act(new Scanner(includes, excludes, useDefaultExcludes));
  } catch (InterruptedException x) {
    throw new IOException(x);
  }
}
@Override public VirtualFile child(String name) {

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

/**
 * Converts this file to the URI, relative to the machine
 * on which this file is available.
 */
public URI toURI() throws IOException, InterruptedException {
  return act(new ToURI());
}
private static class ToURI extends SecureFileCallable<URI> {

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

/**
 * Creates a file (if not already exist) and sets the timestamp.
 *
 * @since 1.299
 */
public void touch(final long timestamp) throws IOException, InterruptedException {
  act(new Touch(timestamp));
}
private class Touch extends SecureFileCallable<Void> {

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

/**
 * Moves all the contents of this directory into the specified directory, then delete this directory itself.
 *
 * @since 1.308.
 */
public void moveAllChildrenTo(final FilePath target) throws IOException, InterruptedException {
  if(this.channel != target.channel) {
    throw new IOException("pullUpTo target must be on the same host");
  }
  act(new MoveAllChildrenTo(target));
}
private class MoveAllChildrenTo extends SecureFileCallable<Void> {

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

/**
 * Creates this directory.
 */
public void mkdirs() throws IOException, InterruptedException {
  if (!act(new Mkdirs())) {
    throw new IOException("Failed to mkdirs: " + remote);
  }
}
private class Mkdirs extends SecureFileCallable<Boolean> {

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

/**
 * Deletes all the contents of this directory, but not the directory itself
 */
public void deleteContents() throws IOException, InterruptedException {
  act(new DeleteContents());
}
private class DeleteContents extends SecureFileCallable<Void> {

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

/**
 * Gets the last modified time stamp of this file, by using the clock
 * of the machine where this file actually resides.
 *
 * @see File#lastModified()
 * @see #touch(long)
 */
public long lastModified() throws IOException, InterruptedException {
  return act(new LastModified());
}
private class LastModified extends SecureFileCallable<Long> {

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

/**
 * Reads this file into a string, by using the current system encoding on the remote machine.
 */
public String readToString() throws IOException, InterruptedException {
  return act(new ReadToString());
} 
private final class ReadToString extends SecureFileCallable<String> {

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

/**
 * Computes the MD5 digest of the file in hex string.
 * @see Util#getDigestOf(File)
 */
public String digest() throws IOException, InterruptedException {
  return act(new Digest());
}
private class Digest extends SecureFileCallable<String> {

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

/**
 * Rename this file/directory to the target filepath.  This FilePath and the target must
 * be on the some host
 */
public void renameTo(final FilePath target) throws IOException, InterruptedException {
  if(this.channel != target.channel) {
    throw new IOException("renameTo target must be on the same host");
  }
  act(new RenameTo(target));
}
private class RenameTo extends SecureFileCallable<Void> {

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

/**
 * Absolutizes this {@link FilePath} and returns the new one.
 */
public FilePath absolutize() throws IOException, InterruptedException {
  return new FilePath(channel, act(new Absolutize()));
}
private static class Absolutize extends SecureFileCallable<String> {

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

private void record(Run<?,?> build, FilePath ws, TaskListener listener, Map<String,String> record, final String targets) throws IOException, InterruptedException {
  for (Record r : ws.act(new FindRecords(targets, build.getTimeInMillis()))) {
    Fingerprint fp = r.addRecord(build);
    if(fp==null) {
      listener.error(Messages.Fingerprinter_FailedFor(r.relativePath));
      continue;
    }
    fp.addFor(build);
    record.put(r.relativePath,fp.getHashString());
  }
}

相关文章