org.fusesource.jansi.Ansi.toString()方法的使用及代码示例

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

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

Ansi.toString介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Replays the last status message.
 */
public void echoStatus() {
  if (lastStatus != null) {
    updateStatus(lastStatus.toString());
  }
}

代码示例来源:origin: prestodb/presto

public void repositionCursor()
{
  if (lines > 0) {
    if (isRealTerminal()) {
      out.print(ansi().cursorUp(lines).toString());
    }
    else {
      out.print('\r');
    }
    out.flush();
    lines = 0;
  }
}

代码示例来源:origin: apache/hive

/**
 * NOTE: Use this method only if isUnixTerminal is true.
 * Repositions the cursor back to line 0.
 */
private void repositionCursor() {
 if (lines > 0) {
  out.print(ansi().cursorUp(lines).toString());
  out.flush();
  lines = 0;
 }
}

代码示例来源:origin: apache/hive

public static void rePositionCursor(PrintStream ps) {
 ps.print(ansi().cursorUp(0).toString());
 ps.flush();
}

代码示例来源:origin: prestodb/presto

public void resetScreen()
{
  if (lines > 0) {
    if (isRealTerminal()) {
      out.print(ansi().cursorUp(lines).eraseScreen(Erase.FORWARD).toString());
    }
    else {
      out.print('\r');
    }
    out.flush();
    lines = 0;
  }
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private String getEmphasisColor(String id) {
    Ansi.Color color = COLOR_MAP.get(id.toUpperCase());
    if (color != null) {
      return id.toLowerCase().equals(id) ?
        // lower case letter means bright color ...
        ansi().fgBright(color).toString() :
        ansi().fg(color).toString();
    } else {
      return "";
    }
  }
}

代码示例来源:origin: apache/drill

private void repositionCursor() {
 if (lines > 0) {
  out.print(ansi().cursorUp(lines).toString());
  out.flush();
  lines = 0;
 }
}

代码示例来源:origin: prestodb/presto

public void reprintLine(String line)
{
  if (isRealTerminal()) {
    out.print(ansi().eraseLine(Erase.ALL).a(line).a('\n').toString());
  }
  else {
    out.print('\r' + line);
  }
  out.flush();
  lines++;
}

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Makes sure that the console has been reset to the default state and that the out stream has been flushed.
 */
public void flush() {
  if (isAnsiEnabled()) {
    out.print(ansi().reset().toString());
  }
  out.flush();
}

代码示例来源:origin: apache/hive

/**
 * NOTE: Use this method only if isUnixTerminal is true.
 * Erases the current line and prints the given multiline. Make sure the specified line is not
 * terminated by linebreak.
 *
 * @param line - line to print
 */
private void reprintMultiLine(String line) {
 int numLines = line.split("\r\n|\r|\n").length;
 out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString());
 out.flush();
 lines += numLines;
}

代码示例来源:origin: apache/drill

private void reprintMultiLine(String line) {
  int numLines = line.split("\r\n|\r|\n").length;
  out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString());
  out.flush();
  lines += numLines;
 }
}

代码示例来源:origin: apache/hive

public static void reprintLine(PrintStream out, String line) {
 out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString());
 out.flush();
}

代码示例来源:origin: fabric8io/docker-maven-plugin

/**
 * Finis progress meter. Must be always called if {@link #progressStart()} has been used.
 */
public void progressFinished() {
  if (!batchMode && log.isInfoEnabled()) {
    imageLines.remove();
    print(ansi().reset().toString());
    if (!useAnsi) {
      println("");
    }
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Shows the prompt to request user input.
 *
 * @return The user input prompt
 */
public String showPrompt() {
  String prompt = isAnsiEnabled() ? ansiPrompt(PROMPT).toString() : PROMPT;
  return showPrompt(prompt);
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private String formatTimestamp(Timestamp timestamp,boolean withColor) {
  if (timeFormatter == null) {
    return "";
  }
  String date = timeFormatter.print(timestamp.getDate());
  return (withColor ?
      ansi().fgBright(BLACK).a(date).reset().toString() :
      date) + " ";
}

代码示例来源:origin: micronaut-projects/micronaut-core

private String doUserInput(String msg, boolean secure) {
  // Add a space to the end of the message if there isn't one already.
  if (!msg.endsWith(" ") && !msg.endsWith("\t")) {
    msg += ' ';
  }
  lastMessage = "";
  msg = isAnsiEnabled() ? outputCategory(ansi(), ">").fg(DEFAULT).a(msg).reset().toString() : msg;
  try {
    return readLine(msg, secure);
  } finally {
    cursorMove = 0;
  }
}

代码示例来源:origin: apache/hive

/**
 * NOTE: Use this method only if isUnixTerminal is true.
 * Erases the current line and prints the given line with the specified color.
 *
 * @param line  - line to print
 * @param color - color for the line
 */
private void reprintLineWithColorAsBold(String line, Ansi.Color color) {
 out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset()
  .toString());
 out.flush();
 lines++;
}

代码示例来源:origin: fabric8io/docker-maven-plugin

/** {@inheritDoc} */
public void verbose(String message, Object ... params) {
  if (verbose) {
    log.info(ansi().fgBright(BLACK).a(prefix).a(format(message, params)).reset().toString());
  }
}

代码示例来源:origin: apache/drill

private void reprintLineWithColorAsBold(String line, Ansi.Color color) {
 out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset()
   .toString());
 out.flush();
 lines++;
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private String colored(String message, Ansi.Color color, boolean addPrefix, Object ... params) {
  Ansi ansi = ansi().fg(color);
  String msgToPrint = addPrefix ? prefix + message : message;
  return ansi.a(format(evaluateEmphasis(msgToPrint, color), params)).reset().toString();
}

相关文章