hudson.model.Run.getLogInputStream()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(108)

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

Run.getLogInputStream介绍

[英]Returns an input stream that reads from the log file. It will use a gzip-compressed log file (log.gz) if that exists.
[中]返回从日志文件读取的输入流。如果存在gzip压缩日志文件(log.gz),它将使用该文件。

代码示例

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

public @Nonnull Reader getLogReader() throws IOException {
  if (charset==null)  return new InputStreamReader(getLogInputStream());
  else                return new InputStreamReader(getLogInputStream(),charset);
}

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

/**
 * Sends out the raw console output.
 */
public void doConsoleText(StaplerRequest req, StaplerResponse rsp) throws IOException {
  rsp.setContentType("text/plain;charset=UTF-8");
  try (InputStream input = getLogInputStream();
     OutputStream os = rsp.getCompressedOutputStream(req);
     PlainTextConsoleOutputStream out = new PlainTextConsoleOutputStream(os)) {
    IOUtils.copy(input, out);
  }
}

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

try (InputStream in = run.getLogInputStream()) {
  byte[] buf = new byte[4096];
  int len;

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

try (InputStream logInputStream = run.getLogInputStream()) {
  IOUtils.skip(logInputStream, pos);
  IOUtils.copy(new InputStreamReader(logInputStream, run.getCharset()), w);

代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper

public InputStream superGetLogInputStream() throws IOException {
  return super.getLogInputStream();
}

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

public Reader getLogReader() throws IOException {
  if (charset == null) {
    return new InputStreamReader(getLogInputStream());
  } else {
    return new InputStreamReader(getLogInputStream(), charset);
  }
}

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

public Reader getLogReader() throws IOException {
  if (charset==null)  return new InputStreamReader(getLogInputStream());
  else                return new InputStreamReader(getLogInputStream(),charset);
}

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

public Reader getLogReader() throws IOException {
  if (charset==null)  return new InputStreamReader(getLogInputStream());
  else                return new InputStreamReader(getLogInputStream(),charset);
}

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

public Reader getLogReader() throws IOException {
  if (charset==null)  return new InputStreamReader(getLogInputStream());
  else                return new InputStreamReader(getLogInputStream(),charset);
}

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

public @Nonnull Reader getLogReader() throws IOException {
  if (charset==null)  return new InputStreamReader(getLogInputStream());
  else                return new InputStreamReader(getLogInputStream(),charset);
}

代码示例来源:origin: jenkinsci/generic-webhook-trigger-plugin

private boolean notLogged(@SuppressWarnings("rawtypes") final Run r) throws IOException {
  try (BufferedReader br =
    new BufferedReader(new InputStreamReader(r.getLogInputStream(), Charsets.UTF_8))) {
   String line;
   while ((line = br.readLine()) != null) {
    if (line.contains(CONTRIBUTING_VARIABLES)) {
     return false;
    }
   }
  }
  return true;
 }
}

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

/**
 * Sends out the raw console output.
 */
public void doConsoleText(StaplerRequest req, StaplerResponse rsp) throws IOException {
  rsp.setContentType("text/plain;charset=UTF-8");
  try (InputStream input = getLogInputStream();
     OutputStream os = rsp.getCompressedOutputStream(req);
     PlainTextConsoleOutputStream out = new PlainTextConsoleOutputStream(os)) {
    IOUtils.copy(input, out);
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper

@Override
public InputStream getLogInputStream() throws IOException {
  initPython();
  if (pexec.isImplemented(48)) {
    return (InputStream) pexec.execPython("get_log_input_stream");
  } else {
    return super.getLogInputStream();
  }
}

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

/**
 * Used from <tt>console.jelly</tt> to write annotated log to the given output.
 *
 * @since 1.349
 */
public void writeLogTo(long offset, @Nonnull XMLOutput out) throws IOException {
  try {
    getLogText().writeHtmlTo(offset,out.asWriter());
  } catch (IOException e) {
    // try to fall back to the old getLogInputStream()
    // mainly to support .gz compressed files
    // In this case, console annotation handling will be turned off.
    try (InputStream input = getLogInputStream()) {
      IOUtils.copy(input, out.asWriter());
    }
  }
}

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

/**
 * Used from <tt>console.jelly</tt> to write annotated log to the given output.
 *
 * @since 1.349
 */
public void writeLogTo(long offset, XMLOutput out) throws IOException {
  try {
    getLogText().writeHtmlTo(offset,out.asWriter());
  } catch (IOException e) {
    // try to fall back to the old getLogInputStream()
    // mainly to support .gz compressed files
    // In this case, console annotation handling will be turned off.
    InputStream input = getLogInputStream();
    try {
      IOUtils.copy(input, out.asWriter());
    } finally {
      IOUtils.closeQuietly(input);
    }
  }
}

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

/**
 * Used from <tt>console.jelly</tt> to write annotated log to the given output.
 *
 * @since 1.349
 */
public void writeLogTo(long offset, XMLOutput out) throws IOException {
  try {
    getLogText().writeHtmlTo(offset,out.asWriter());
  } catch (IOException e) {
    // try to fall back to the old getLogInputStream()
    // mainly to support .gz compressed files
    // In this case, console annotation handling will be turned off.
    InputStream input = getLogInputStream();
    try {
      IOUtils.copy(input, out.asWriter());
    } finally {
      IOUtils.closeQuietly(input);
    }
  }
}

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

/**
 * Used from <tt>console.jelly</tt> to write annotated log to the given output.
 *
 * @since 1.349
 */
public void writeLogTo(long offset, XMLOutput out) throws IOException {
  try {
    getLogText().writeHtmlTo(offset,out.asWriter());
  } catch (IOException e) {
    // try to fall back to the old getLogInputStream()
    // mainly to support .gz compressed files
    // In this case, console annotation handling will be turned off.
    InputStream input = getLogInputStream();
    try {
      IOUtils.copy(input, out.asWriter());
    } finally {
      IOUtils.closeQuietly(input);
    }
  }
}

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

/**
 * Used from <tt>console.jelly</tt> to write annotated log to the given
 * output.
 *
 * @since 1.349
 */
public void writeLogTo(long offset, XMLOutput out) throws IOException {
  try {
    getLogText().writeHtmlTo(offset, out.asWriter());
  } catch (IOException e) {
    // try to fall back to the old getLogInputStream()
    // mainly to support .gz compressed files
    // In this case, console annotation handling will be turned off.
    InputStream input = getLogInputStream();
    try {
      IOUtils.copy(input, out.asWriter());
    } finally {
      IOUtils.closeQuietly(input);
    }
  }
}

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

try (InputStream in = run.getLogInputStream()) {
  byte[] buf = new byte[4096];
  int len;

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

try (InputStream logInputStream = run.getLogInputStream()) {
  IOUtils.skip(logInputStream, pos);
  IOUtils.copy(new InputStreamReader(logInputStream, run.getCharset()), w);

相关文章

微信公众号

最新文章

更多

Run类方法