org.codehaus.groovy.tools.shell.IO.flush()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(76)

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

IO.flush介绍

[英]Flush both output streams.
[中]刷新两个输出流。

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

private void log(final String level, Object msg, Throwable cause) {
  assert level != null;
  assert msg != null;
  if (io == null) {
    synchronized (Logger.class) {
      if (io == null) {
        io = new IO();
      }
    }
  }
  // Allow the msg to be a Throwable, and handle it properly if no cause is given
  if (cause == null) {
    if (msg instanceof Throwable) {
      cause = (Throwable) msg;
      msg = cause.getMessage();
    }
  }
  Color color = GREEN;
  if (WARN.equals(level) || ERROR.equals(level)) {
    color = RED;
  }
  io.out.println(ansi().a(INTENSITY_BOLD).fg(color).a(level).reset().a(" [").a(name).a("] ").a(msg));
  if (cause != null) {
    cause.printStackTrace(io.out);
  }
  io.flush();
}

代码示例来源:origin: org.kohsuke.droovy/groovy

io.flush();

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

io.flush();

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

io.flush();

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

private void log(final String level, Object msg, Throwable cause) {
  assert level != null;
  assert msg != null;
  
  if (io == null) {
    io = new IO();
  }
  // Allow the msg to be a Throwable, and handle it properly if no cause is given
  if (cause == null) {
    if (msg instanceof Throwable) {
      cause = (Throwable) msg;
      msg = cause.getMessage();
    }
  }
  Color color = GREEN;
  if (WARN.equals(level) || ERROR.equals(level)) {
    color = RED;
  }
  io.out.println(ansi().a(INTENSITY_BOLD).a(color).a(level).reset().a(" [").a(name).a("] ").a(msg));
  if (cause != null) {
    cause.printStackTrace(io.out);
  }
  try {
    io.flush();
  } catch (IOException io) {
    throw new RuntimeException(io);
  }
}

相关文章

微信公众号

最新文章

更多