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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @SuppressWarnings("unused")
  2. public String getLog() throws IOException {
  3. File logFile = getLogFile();
  4. if (logFile == null) {
  5. return null;
  6. }
  7. return Util.loadFile(logFile);
  8. }

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Get log.
  3. */
  4. @SuppressWarnings("unused")
  5. public String getLog() throws IOException {
  6. return Util.loadFile(getLogFile());
  7. }

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

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

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

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

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

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

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

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

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

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

相关文章