org.codehaus.groovy.tools.shell.IO类的使用及代码示例

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

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

IO介绍

[英]Container for input/output handles.
[中]输入/输出句柄的容器。

代码示例

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

  1. binding.setProperty("jenkins", Jenkins.getActiveInstance());
  2. IO io = new IO(new BufferedInputStream(stdin),stdout,stderr);

代码示例来源: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.codehaus.groovy/groovy

  1. /**
  2. * Check if the verbosity level is set to {@link Verbosity#VERBOSE}.
  3. */
  4. public boolean isVerbose() {
  5. return getVerbosity() == Verbosity.VERBOSE;
  6. }

代码示例来源:origin: org.codehaus.gmaven.runtime/gmaven-runtime-1.6

  1. public DefaultTask(final Configuration config) {
  2. assert config != null;
  3. io = new IO();
  4. Logger.io = io;
  5. if (config.get(VERBOSE, false)) {
  6. io.setVerbosity(IO.Verbosity.VERBOSE);
  7. }
  8. if (config.get(DEBUG, false)) {
  9. io.setVerbosity(IO.Verbosity.DEBUG);
  10. }
  11. if (config.get(QUIET, false)) {
  12. io.setVerbosity(IO.Verbosity.QUIET);
  13. }
  14. String color = config.get(COLOR, Boolean.TRUE.toString());
  15. if (color != null) {
  16. Main.setColor(color);
  17. }
  18. String term = config.get(TERMINAL, (String)null);
  19. if (term != null) {
  20. Main.setTerminalType(term);
  21. }
  22. args = config.get(ARGS, (String)null);
  23. }

代码示例来源:origin: org.codehaus.groovy.maven.runtime/gmaven-runtime-1.6

  1. public DefaultTask(final Configuration config) {
  2. assert config != null;
  3. io = new IO();
  4. Logger.io = io;
  5. if (config.get(VERBOSE, false)) {
  6. io.setVerbosity(IO.Verbosity.VERBOSE);
  7. }
  8. if (config.get(DEBUG, false)) {
  9. io.setVerbosity(IO.Verbosity.DEBUG);
  10. }
  11. if (config.get(QUIET, false)) {
  12. io.setVerbosity(IO.Verbosity.QUIET);
  13. }
  14. String color = config.get(COLOR, Boolean.TRUE.toString());
  15. if (color != null) {
  16. Main.setColor(color);
  17. }
  18. String term = config.get(TERMINAL, (String)null);
  19. if (term != null) {
  20. Main.setTerminalType(term);
  21. }
  22. args = config.get(ARGS, (String)null);
  23. }

代码示例来源:origin: thinkaurelius/faunus

  1. public Console() {
  2. this(new IO(System.in, System.out, System.err), STANDARD_INPUT_PROMPT, STANDARD_RESULT_PROMPT);
  3. }

代码示例来源:origin: org.codehaus.gmaven.runtime/gmaven-runtime-1.7

  1. public DefaultTask(final Configuration config) {
  2. assert config != null;
  3. io = new IO();
  4. Logger.io = io;
  5. if (config.get(VERBOSE, false)) {
  6. io.setVerbosity(IO.Verbosity.VERBOSE);
  7. }
  8. if (config.get(DEBUG, false)) {
  9. io.setVerbosity(IO.Verbosity.DEBUG);
  10. }
  11. if (config.get(QUIET, false)) {
  12. io.setVerbosity(IO.Verbosity.QUIET);
  13. }
  14. String color = config.get(COLOR, Boolean.TRUE.toString());
  15. if (color != null) {
  16. Main.setColor(color);
  17. }
  18. String term = config.get(TERMINAL, (String)null);
  19. if (term != null) {
  20. Main.setTerminalType(term);
  21. }
  22. args = config.get(ARGS, (String)null);
  23. }

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

  1. io = new IO();
  2. io.flush();

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

  1. /**
  2. * Check if the verbosity level is set to {@link Verbosity#QUIET}.
  3. */
  4. public boolean isQuiet() {
  5. return getVerbosity() == Verbosity.QUIET;
  6. }

代码示例来源:origin: opencypher/cypher-for-gremlin

  1. public void start() {
  2. System.setProperty("plugins", "v3d3");
  3. PipedInputStream in = new PipedInputStream();
  4. replaceSystemIn(in);
  5. try {
  6. input = new PrintWriter(new PipedOutputStream(in));
  7. } catch (IOException e) {
  8. throw new RuntimeException(e);
  9. }
  10. console = new Thread(() -> new Console(new IO(), new ArrayList<>(), true));
  11. console.start();
  12. }

代码示例来源:origin: org.codehaus.gmaven.runtime/gmaven-runtime-2.0

  1. public DefaultTask(final Configuration config) {
  2. assert config != null;
  3. io = new IO();
  4. Logger.io = io;
  5. if (config.get(VERBOSE, false)) {
  6. io.setVerbosity(IO.Verbosity.VERBOSE);
  7. }
  8. if (config.get(DEBUG, false)) {
  9. io.setVerbosity(IO.Verbosity.DEBUG);
  10. }
  11. if (config.get(QUIET, false)) {
  12. io.setVerbosity(IO.Verbosity.QUIET);
  13. }
  14. String color = config.get(COLOR, Boolean.TRUE.toString());
  15. if (color != null) {
  16. Main.setColor(color);
  17. }
  18. String term = config.get(TERMINAL, (String)null);
  19. if (term != null) {
  20. Main.setTerminalType(term);
  21. }
  22. args = config.get(ARGS, (String)null);
  23. }

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

  1. io = new IO();
  2. io.flush();

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

  1. /**
  2. * Check if the verbosity level is set to {@link Verbosity#INFO}.
  3. */
  4. public boolean isInfo() {
  5. return getVerbosity() == Verbosity.INFO;
  6. }

代码示例来源:origin: io.corbel.lib/cli

  1. private Groovysh createShell() {
  2. if (welcomeMessage != null) {
  3. writer.println(SEPARATOR_BAR);
  4. writer.println(welcomeMessage);
  5. writer.println(SEPARATOR_BAR);
  6. }
  7. binding.setVariable(OUT_KEY, out);
  8. final CompilerConfiguration config = new CompilerConfiguration();
  9. final GroovyClassLoader loader = new GroovyClassLoader(this.getClass().getClassLoader(), config);
  10. final Groovysh shell = new Groovysh(loader, binding, new IO(in, out, out));
  11. writer.flush();
  12. return shell;
  13. }

代码示例来源:origin: org.codehaus.gmaven.runtime/gmaven-runtime-1.5

  1. public DefaultTask(final Configuration config) {
  2. assert config != null;
  3. io = new IO();
  4. Logger.io = io;
  5. if (config.get(VERBOSE, false)) {
  6. io.setVerbosity(IO.Verbosity.VERBOSE);
  7. }
  8. if (config.get(DEBUG, false)) {
  9. io.setVerbosity(IO.Verbosity.DEBUG);
  10. }
  11. if (config.get(QUIET, false)) {
  12. io.setVerbosity(IO.Verbosity.QUIET);
  13. }
  14. String color = config.get(COLOR, Boolean.TRUE.toString());
  15. if (color != null) {
  16. Main.setColor(color);
  17. }
  18. String term = config.get(TERMINAL, (String)null);
  19. if (term != null) {
  20. Main.setTerminalType(term);
  21. }
  22. args = config.get(ARGS, (String)null);
  23. }

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

  1. io = new IO();
  2. io.flush();

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

  1. /**
  2. * Check if the verbosity level is set to {@link Verbosity#DEBUG}.
  3. *
  4. * <p>For general usage, when debug output is required, it is better
  5. * to use the logging facility instead.
  6. */
  7. public boolean isDebug() {
  8. return getVerbosity() == Verbosity.DEBUG;
  9. }

代码示例来源:origin: com.bq.oss.lib/cli

  1. private Groovysh createShell() {
  2. if (welcomeMessage != null) {
  3. writer.println(SEPARATOR_BAR);
  4. writer.println(welcomeMessage);
  5. writer.println(SEPARATOR_BAR);
  6. }
  7. binding.setVariable(OUT_KEY, out);
  8. final CompilerConfiguration config = new CompilerConfiguration();
  9. final GroovyClassLoader loader = new GroovyClassLoader(this.getClass().getClassLoader(), config);
  10. final Groovysh shell = new Groovysh(loader, binding, new IO(in, out, out));
  11. writer.flush();
  12. return shell;
  13. }

代码示例来源:origin: org.codehaus.mojo.groovy.runtime/groovy-runtime-1.1

  1. public DefaultTask(final Configuration config) {
  2. assert config != null;
  3. io = new IO();
  4. Logger.io = io;
  5. if (config.get(VERBOSE, false)) {
  6. io.setVerbosity(IO.Verbosity.VERBOSE);
  7. }
  8. if (config.get(DEBUG, false)) {
  9. io.setVerbosity(IO.Verbosity.DEBUG);
  10. }
  11. if (config.get(QUIET, false)) {
  12. io.setVerbosity(IO.Verbosity.QUIET);
  13. }
  14. String color = config.get(COLOR, Boolean.TRUE.toString());
  15. if (color != null) {
  16. Main.setColor(color);
  17. }
  18. String term = config.get(TERMINAL, (String)null);
  19. if (term != null) {
  20. Main.setTerminalType(term);
  21. }
  22. args = config.get(ARGS, (String)null);
  23. }

代码示例来源: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. }

相关文章