• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AnsiOutput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.boot.ansi.AnsiOutput的典型用法代码示例。如果您正苦于以下问题:Java AnsiOutput类的具体用法?Java AnsiOutput怎么用?Java AnsiOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnsiOutput类属于org.springframework.boot.ansi包,在下文中一共展示了AnsiOutput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: printBanner

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
		PrintStream printStream) {
	for (String line : BANNER) {
		printStream.println(line);
	}
	String version = SpringBootVersion.getVersion();
	version = (version == null ? "" : " (v" + version + ")");
	String padding = "";
	while (padding.length() < STRAP_LINE_SIZE
			- (version.length() + SPRING_BOOT.length())) {
		padding += " ";
	}

	printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT,
			AnsiColor.DEFAULT, padding, AnsiStyle.FAINT, version));
	printStream.println();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:SpringBootBanner.java


示例2: printBanner

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
                        PrintStream printStream) {
    for (String line : BANNER) {
        printStream.println(line);
    }
    String version = FountainBanner.class.getPackage().getImplementationVersion();
    version = (version == null ? "" : " (v" + version + ")");
    String padding = "";
    while (padding.length() < STRAP_LINE_SIZE
            - (version.length() + FOUNTAIN.length())) {
        padding += " ";
    }

    printStream.println(AnsiOutput.toString(GREEN, FOUNTAIN, DEFAULT, padding,
            FAINT, version));
    printStream.println();
}
 
开发者ID:neoremind,项目名称:fountain,代码行数:19,代码来源:FountainBanner.java


示例3: getPrompt

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Override
public String getPrompt() {
    return AbstractShell.shellPrompt =
            AnsiOutput.toString(AnsiColor.CYAN, "hdfs-shell ") +
                    AnsiOutput.toString(AnsiColor.YELLOW, contextCommands.getCurrentDir()) +
                    AnsiOutput.toString(AnsiColor.CYAN, " >", AnsiColor.WHITE);
}
 
开发者ID:avast,项目名称:hdfs-shell,代码行数:8,代码来源:ShellPromptProvider.java


示例4: onApplicationEvent

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
			event.getEnvironment(), "spring.output.ansi.");
	if (resolver.containsProperty("enabled")) {
		String enabled = resolver.getProperty("enabled");
		AnsiOutput.setEnabled(Enum.valueOf(Enabled.class, enabled.toUpperCase()));
	}

	if (resolver.containsProperty("console-available")) {
		AnsiOutput.setConsoleAvailable(
				resolver.getProperty("console-available", Boolean.class));
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:AnsiOutputApplicationListener.java


示例5: printBanner

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
private void printBanner(BufferedImage image, int margin, boolean invert,
		PrintStream out) {
	AnsiElement background = (invert ? AnsiBackground.BLACK : AnsiBackground.DEFAULT);
	out.print(AnsiOutput.encode(AnsiColor.DEFAULT));
	out.print(AnsiOutput.encode(background));
	out.println();
	out.println();
	AnsiColor lastColor = AnsiColor.DEFAULT;
	for (int y = 0; y < image.getHeight(); y++) {
		for (int i = 0; i < margin; i++) {
			out.print(" ");
		}
		for (int x = 0; x < image.getWidth(); x++) {
			Color color = new Color(image.getRGB(x, y), false);
			AnsiColor ansiColor = AnsiColors.getClosest(color);
			if (ansiColor != lastColor) {
				out.print(AnsiOutput.encode(ansiColor));
				lastColor = ansiColor;
			}
			out.print(getAsciiPixel(color, invert));
		}
		out.println();
	}
	out.print(AnsiOutput.encode(AnsiColor.DEFAULT));
	out.print(AnsiOutput.encode(AnsiBackground.DEFAULT));
	out.println();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:28,代码来源:ImageBanner.java


示例6: printBannerShouldResetForegroundAndBackground

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerShouldResetForegroundAndBackground() {
	String banner = printBanner("black-and-white.gif");
	String expected = AnsiOutput.encode(AnsiColor.DEFAULT)
			+ AnsiOutput.encode(AnsiBackground.DEFAULT);
	assertThat(banner).startsWith(expected);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ImageBannerTests.java


示例7: printBannerWhenInvertedShouldResetForegroundAndBackground

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerWhenInvertedShouldResetForegroundAndBackground() {
	String banner = printBanner("black-and-white.gif", INVERT_TRUE);
	String expected = AnsiOutput.encode(AnsiColor.DEFAULT)
			+ AnsiOutput.encode(AnsiBackground.BLACK);
	assertThat(banner).startsWith(expected);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ImageBannerTests.java


示例8: printBannerShouldPrintWhiteAsBrightWhiteHighLuminance

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerShouldPrintWhiteAsBrightWhiteHighLuminance() {
	String banner = printBanner("black-and-white.gif");
	String expected = AnsiOutput.encode(AnsiColor.BRIGHT_WHITE)
			+ HIGH_LUMINANCE_CHARACTER;
	assertThat(banner).contains(expected);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ImageBannerTests.java


示例9: printBannerWhenInvertedShouldPrintWhiteAsBrightWhiteLowLuminance

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerWhenInvertedShouldPrintWhiteAsBrightWhiteLowLuminance() {
	String banner = printBanner("black-and-white.gif", INVERT_TRUE);
	String expected = AnsiOutput.encode(AnsiColor.BRIGHT_WHITE)
			+ LOW_LUMINANCE_CHARACTER;
	assertThat(banner).contains(expected);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ImageBannerTests.java


示例10: printBannerWhenShouldPrintAllColors

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerWhenShouldPrintAllColors() {
	String banner = printBanner("colors.gif");
	for (AnsiColor color : AnsiColor.values()) {
		if (color != AnsiColor.DEFAULT) {
			assertThat(banner).contains(AnsiOutput.encode(color));
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:ImageBannerTests.java


示例11: printBannerShouldRenderGradient

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerShouldRenderGradient() throws Exception {
	AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
	String banner = printBanner("gradient.gif", "banner.image.width=10",
			"banner.image.margin=0");
	assertThat(banner).contains("@#8&o:*.  ");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ImageBannerTests.java


示例12: printBannerShouldCapWidthAndCalculateHeight

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerShouldCapWidthAndCalculateHeight() throws Exception {
	AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
	String banner = printBanner("large.gif", "banner.image.margin=0");
	assertThat(getBannerWidth(banner)).isEqualTo(76);
	assertThat(getBannerHeight(banner)).isEqualTo(37);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ImageBannerTests.java


示例13: printBannerShouldPrintMargin

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerShouldPrintMargin() throws Exception {
	AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
	String banner = printBanner("large.gif");
	String[] lines = banner.split(NEW_LINE);
	for (int i = 2; i < lines.length - 1; i++) {
		assertThat(lines[i]).startsWith("  @");
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:ImageBannerTests.java


示例14: printBannerWhenHasMarginPropertyShouldPrintSizedMargin

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void printBannerWhenHasMarginPropertyShouldPrintSizedMargin()
		throws Exception {
	AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
	String banner = printBanner("large.gif", "banner.image.margin=4");
	String[] lines = banner.split(NEW_LINE);
	for (int i = 2; i < lines.length - 1; i++) {
		assertThat(lines[i]).startsWith("    @");
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:ImageBannerTests.java


示例15: renderWithColors

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void renderWithColors() throws Exception {
	Resource resource = new ByteArrayResource(
			"${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
	AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
	String banner = printBanner(resource, null, null, null);
	assertThat(banner).startsWith("\u001B[31mThis is red.\u001B[0m");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:ResourceBannerTests.java


示例16: renderWithColorsButDisabled

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void renderWithColorsButDisabled() throws Exception {
	Resource resource = new ByteArrayResource(
			"${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
	AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
	String banner = printBanner(resource, null, null, null);
	assertThat(banner).startsWith("This is red.");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:ResourceBannerTests.java


示例17: captureOutput

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
protected void captureOutput() {
	AnsiOutput.setEnabled(Enabled.NEVER);
	this.copy = new ByteArrayOutputStream();
	this.captureOut = new CaptureOutputStream(System.out, this.copy);
	this.captureErr = new CaptureOutputStream(System.err, this.copy);
	System.setOut(new PrintStream(this.captureOut));
	System.setErr(new PrintStream(this.captureErr));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:InternalOutputCapture.java


示例18: onApplicationEvent

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
    serviceQueueRegistry.getItems().forEach(item -> {

        final ServiceQueue serviceQueue = applicationContext.getBean(item.getKey(), ServiceQueue.class);

        if (clusteredEventManager != null && (boolean) item.getValue().get("remoteEventListener")) {
            clusteredEventManager.joinService(serviceQueue);
        }

        if (serviceEndpointServer != null && (boolean) item.getValue().get("exposeRemoteEndpoint")) {
            final String endpointLocation = (String) item.getValue().get("endpointLocation");
            logger.info(AnsiOutput.toString("Registering endpoint: ", BOLD, GREEN, endpointLocation, NORMAL));
            serviceEndpointServer.addServiceQueue(endpointLocation, serviceQueue);

            logger.info("Starting service queue as part of endpoint {}", serviceQueue.name());
            serviceQueue.startServiceQueue();
        } else {
            logger.info("Starting service queue standalone {}", serviceQueue.name());
            serviceQueue.start();
            serviceQueue.startCallBackHandler();
        }

    });
    if (serviceEndpointServer != null) {
        serviceEndpointServer.start();
    }

    applicationContext.publishEvent(new QBitStartedEvent(applicationContext));
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:31,代码来源:ServiceQueueInitializer.java


示例19: renderWithColors

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void renderWithColors() throws Exception {
	Resource resource = new ByteArrayResource(
			"${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
	AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
	String banner = printBanner(resource, null, null);
	assertThat(banner, startsWith("\u001B[31mThis is red.\u001B[0m"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:ResourceBannerTests.java


示例20: renderWithColorsButDisabled

import org.springframework.boot.ansi.AnsiOutput; //导入依赖的package包/类
@Test
public void renderWithColorsButDisabled() throws Exception {
	Resource resource = new ByteArrayResource(
			"${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
	AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
	String banner = printBanner(resource, null, null);
	assertThat(banner, startsWith("This is red."));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:ResourceBannerTests.java



注:本文中的org.springframework.boot.ansi.AnsiOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FieldEvent类代码示例发布时间:2022-05-23
下一篇:
Java Enum类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap