当前位置: 首页>>代码示例>>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;未经允许,请勿转载。