hudson.Util.loadFile()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(228)

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

Util.loadFile介绍

[英]Reads the entire contents of the text file at logfile into a string using the Charset#defaultCharset() for decoding. If no such file exists, an empty string is returned.
[中]使用字符集#defaultCharset()进行解码,将logfile处文本文件的全部内容读入字符串。如果不存在这样的文件,则返回一个空字符串。

代码示例

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

/**
 * Reads the entire contents of the text file at <code>logfile</code> into a
 * string using the {@link Charset#defaultCharset() default charset} for
 * decoding. If no such file exists, an empty string is returned.
 * @param logfile The text file to read in its entirety.
 * @return The entire text content of <code>logfile</code>.
 * @throws IOException If an error occurs while reading the file.
 * @deprecated call {@link #loadFile(java.io.File, java.nio.charset.Charset)}
 * instead to specify the charset to use for decoding (preferably
 * {@link java.nio.charset.StandardCharsets#UTF_8}).
 */
@Nonnull
@Deprecated
public static String loadFile(@Nonnull File logfile) throws IOException {
  return loadFile(logfile, Charset.defaultCharset());
}

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

/**
 * Gets the string representation of the agent log.
 */
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
 * Gets the log of the build as a string.
 * @return Returns the log or an empty string if it has not been found
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public @Nonnull String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

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

/**
 * Loads the contents of a file into a string.
 */
public static String loadFile(File logfile) throws IOException {
  return loadFile(logfile, Charset.defaultCharset());
}

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

/**
 * Loads the contents of a file into a string.
 */
public static String loadFile(File logfile) throws IOException {
  return loadFile(logfile, Charset.defaultCharset());
}

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

/**
 * Loads the contents of a file into a string.
 */
@Nonnull
public static String loadFile(@Nonnull File logfile) throws IOException {
  return loadFile(logfile, Charset.defaultCharset());
}

代码示例来源:origin: org.jenkins-ci.lib/xtrigger-lib

@SuppressWarnings("unused")
public String getLog() throws IOException {
  File logFile = getLogFile();
  if (logFile == null) {
    return null;
  }
  return Util.loadFile(logFile);
}

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

/**
 * Gets the string representation of the slave log.
 */
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
 * Gets the string representation of the agent log.
 */
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
 * Gets the string representation of the slave log.
 */
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
 * Gets the string representation of the slave log.
 */
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
 * Gets the string representation of the slave log.
 */
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
* Get log.
*/
@SuppressWarnings("unused")
public String getLog() throws IOException {
  return Util.loadFile(getLogFile());
}

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

/**
 * Gets the log of the build as a string.
 * @return Returns the log or an empty string if it has not been found
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public @Nonnull String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

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

/**
 * Gets the log of the build as a string.
 *
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

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

/**
 * Gets the log of the build as a string.
 *
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

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

/**
 * Get entire log file (this method is deprecated in hudson.model.Run,
 * but in tests it is OK to load entire log).
 */
protected static String getLog(Run run) throws IOException {
  return Util.loadFile(run.getLogFile(), run.getCharset());
}

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

/**
 * Get entire log file (this method is deprecated in hudson.model.Run, but
 * in tests it is OK to load entire log).
 */
protected static String getLog(Run run) throws IOException {
  return Util.loadFile(run.getLogFile(), run.getCharset());
}

相关文章