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

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

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

  1. private void log(final String level, Object msg, Throwable cause) {
  2. assert level != null;
  3. assert msg != null;
  4. if (io == null) {
  5. synchronized (Logger.class) {
  6. if (io == null) {
  7. io = new IO();
  8. }
  9. }
  10. }
  11. // Allow the msg to be a Throwable, and handle it properly if no cause is given
  12. if (cause == null) {
  13. if (msg instanceof Throwable) {
  14. cause = (Throwable) msg;
  15. msg = cause.getMessage();
  16. }
  17. }
  18. Color color = GREEN;
  19. if (WARN.equals(level) || ERROR.equals(level)) {
  20. color = RED;
  21. }
  22. io.out.println(ansi().a(INTENSITY_BOLD).fg(color).a(level).reset().a(" [").a(name).a("] ").a(msg));
  23. if (cause != null) {
  24. cause.printStackTrace(io.out);
  25. }
  26. io.flush();
  27. }

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

  1. io.flush();

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

  1. io.flush();

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

  1. io.flush();

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

  1. private void log(final String level, Object msg, Throwable cause) {
  2. assert level != null;
  3. assert msg != null;
  4. if (io == null) {
  5. io = new IO();
  6. }
  7. // Allow the msg to be a Throwable, and handle it properly if no cause is given
  8. if (cause == null) {
  9. if (msg instanceof Throwable) {
  10. cause = (Throwable) msg;
  11. msg = cause.getMessage();
  12. }
  13. }
  14. Color color = GREEN;
  15. if (WARN.equals(level) || ERROR.equals(level)) {
  16. color = RED;
  17. }
  18. io.out.println(ansi().a(INTENSITY_BOLD).a(color).a(level).reset().a(" [").a(name).a("] ").a(msg));
  19. if (cause != null) {
  20. cause.printStackTrace(io.out);
  21. }
  22. try {
  23. io.flush();
  24. } catch (IOException io) {
  25. throw new RuntimeException(io);
  26. }
  27. }

相关文章