當前位置: 首頁>>代碼示例>>Java>>正文


Java Ansi.ansi方法代碼示例

本文整理匯總了Java中org.fusesource.jansi.Ansi.ansi方法的典型用法代碼示例。如果您正苦於以下問題:Java Ansi.ansi方法的具體用法?Java Ansi.ansi怎麽用?Java Ansi.ansi使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.fusesource.jansi.Ansi的用法示例。


在下文中一共展示了Ansi.ansi方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: translate

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
public static String translate(Object... elements) {

        Ansi ansi = Ansi.ansi();

        for (Object element : elements) {
            if (element instanceof Ansi.Color) {
                ansi.fg((Ansi.Color) element);
                continue;
            }
            else if (element == RESET) {
                ansi.reset();
                continue;
            }

            ansi.a(element);
            ansi.a(" ");
        }

        return ansi.toString();
    }
 
開發者ID:dzikoysk,項目名稱:NanoMaven,代碼行數:21,代碼來源:AnsiUtils.java

示例2: createAnsi

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
Ansi createAnsi() {
    if (forceAnsi) {
        return new Ansi();
    } else {
        return Ansi.ansi();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:8,代碼來源:AnsiConsole.java

示例3: clear

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
public static Ansi clear(final Map2D<TerminalPixel> image) {
    Preconditions.checkNotNull(image);
    final Ansi ansi = Ansi.ansi();
    for (int y = 0; y < image.height(); y++) {
        ansi.eraseLine(Ansi.Erase.ALL)
            .cursorToColumn(0)
            .cursorUpLine();
    }
    return ansi;
}
 
開發者ID:LoopPerfect,項目名稱:buckaroo,代碼行數:11,代碼來源:TerminalBuffer.java

示例4: append

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
/**
 * Append text with the given ANSI codes.
 * @param text the text to append
 * @param codes the ANSI codes
 * @return this string
 */
AnsiString append(String text, Code... codes) {
	if (codes.length == 0 || !isAnsiSupported()) {
		this.value.append(text);
		return this;
	}
	Ansi ansi = Ansi.ansi();
	for (Code code : codes) {
		ansi = applyCode(ansi, code);
	}
	this.value.append(ansi.a(text).reset().toString());
	return this;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:19,代碼來源:AnsiString.java

示例5: format

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
@Override
public String format(LogRecord record) {
	if (record.getThrown() != null) {
		record.getThrown().printStackTrace();
	}
	Ansi ansi = Ansi.ansi();
	if (Visage.ansi) {
		ansi.fgBright(Color.BLACK);
	}
	Date date = new Date(record.getMillis());
	ansi.a("@");
	ansi.a(format.format(date));
	if (Visage.ansi) {
		ansi.reset();
	}
	ansi.a(Strings.padStart(Thread.currentThread().getName(), 22, ' '));
	ansi.a(" ");
	if (Visage.ansi && colors.containsKey(record.getLevel())) {
		ansi.fgBright(colors.get(record.getLevel()));
	}
	ansi.a(names.get(record.getLevel()));
	if (Visage.ansi) {
		ansi.reset();
	}
	ansi.a(": ");
	if (Visage.ansi && colors.containsKey(record.getLevel()) && record.getLevel().intValue() >= Level.SEVERE.intValue()) {
		ansi.bold();
		ansi.fgBright(colors.get(record.getLevel()));
	}
	ansi.a(record.getMessage());
	if (Visage.ansi) {
		ansi.reset();
	}
	ansi.a("\n");
	return ansi.toString();
}
 
開發者ID:surgeplay,項目名稱:Visage,代碼行數:37,代碼來源:VisageFormatter.java

示例6: renderErrorLocation

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
private static void renderErrorLocation(String query, ErrorLocation location, PrintStream out)
{
    List<String> lines = ImmutableList.copyOf(Splitter.on('\n').split(query).iterator());

    String errorLine = lines.get(location.getLineNumber() - 1);
    String good = errorLine.substring(0, location.getColumnNumber() - 1);
    String bad = errorLine.substring(location.getColumnNumber() - 1);

    if ((location.getLineNumber() == lines.size()) && bad.trim().isEmpty()) {
        bad = " <EOF>";
    }

    if (REAL_TERMINAL) {
        Ansi ansi = Ansi.ansi();

        ansi.fg(Ansi.Color.CYAN);
        for (int i = 1; i < location.getLineNumber(); i++) {
            ansi.a(lines.get(i - 1)).newline();
        }
        ansi.a(good);

        ansi.fg(Ansi.Color.RED);
        ansi.a(bad).newline();
        for (int i = location.getLineNumber(); i < lines.size(); i++) {
            ansi.a(lines.get(i)).newline();
        }

        ansi.reset();
        out.print(ansi);
    }
    else {
        String prefix = format("LINE %s: ", location.getLineNumber());
        String padding = Strings.repeat(" ", prefix.length() + (location.getColumnNumber() - 1));
        out.println(prefix + errorLine);
        out.println(padding + "^");
    }
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:38,代碼來源:Query.java

示例7: printClear

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
@Override
protected void printClear() {
    AnsiConsole.systemInstall();
    Ansi ansi = Ansi.ansi();
    System.out.println( ansi.eraseScreen() );
    System.out.println( ansi.cursor(0, 0) );
    AnsiConsole.systemUninstall();
}
 
開發者ID:sigmoidanalytics,項目名稱:spork-streaming,代碼行數:9,代碼來源:GruntParser.java

示例8: render

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
/**
 * Renders the given text with the given names which can be ANSI code names or Log4j style names.
 * 
 * @param text
 *            The text to render
 * @param names
 *            ANSI code names or Log4j style names.
 * @return A rendered string containing ANSI codes.
 */
private String render(final String text, final String... names) {
    final Ansi ansi = Ansi.ansi();
    for (final String name : names) {
        final Code[] codes = styleMap.get(name);
        if (codes != null) {
            render(ansi, codes);
        } else {
            render(ansi, toCode(name));
        }
    }
    return ansi.a(text).reset().toString();
}
 
開發者ID:apache,項目名稱:logging-log4j2,代碼行數:22,代碼來源:JAnsiTextRenderer.java

示例9: AnsiPrintToolkit

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
public AnsiPrintToolkit() {
    this(Ansi.ansi());
}
 
開發者ID:andyphillips404,項目名稱:awplab-core,代碼行數:4,代碼來源:AnsiPrintToolkit.java

示例10: resetOutputBuilders

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
/**
 * Reset both output builders.
 */
private void resetOutputBuilders() {
    ansi = Ansi.ansi();
    stringBuilder = new StringBuilder();
}
 
開發者ID:box,項目名稱:mojito,代碼行數:8,代碼來源:ConsoleWriter.java

示例11: createAnsi

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
Ansi createAnsi() {
    return Ansi.ansi();
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:4,代碼來源:AnsiConsole.java

示例12: ansi

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
protected final Ansi ansi() {
    return Ansi.ansi();
}
 
開發者ID:jcgay,項目名稱:maven-color,代碼行數:4,代碼來源:CustomColorization.java

示例13: execute

import org.fusesource.jansi.Ansi; //導入方法依賴的package包/類
@Override
public Object execute() throws Exception {

    Ansi buffer = Ansi.ansi();
    boolean found = false;
    for (Factory factory : managerService.getFactories()) {

        if (name.equals(factory.getName())) {
            printFactoryDetails(buffer, factory);
            found = true;
        }
    }

    PrintStream stream = System.out;
    if (!found) {
        // Use error stream
        stream = System.err;

        // Creates an error message
        buffer.a(" [");
        buffer.a(Ansi.Color.RED);
        buffer.a("ERROR");
        buffer.reset();
        buffer.a("] ");

        buffer.a("Factory '");
        buffer.a(Ansi.Attribute.ITALIC);
        buffer.a(name);
        buffer.a(Ansi.Attribute.ITALIC_OFF);
        buffer.a("' was not found.\n");
    }

    // Flush buffer's content
    stream.println(buffer.toString());

    return null;
}
 
開發者ID:andyphillips404,項目名稱:awplab-core,代碼行數:38,代碼來源:FactoryCommand.java


注:本文中的org.fusesource.jansi.Ansi.ansi方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。