List of usage examples for com.google.common.base Strings repeat
public static String repeat(String string, int count)
From source file:cn.edu.zjnu.acm.judge.Application.java
public static void main(String[] args) { ApplicationContext context = SpringApplication.run(Application.class, args); if (log.isInfoEnabled() && context instanceof WebServerApplicationContext) { int port = ((WebServerApplicationContext) context).getWebServer().getPort(); String contextPath = context.getApplicationName(); final String dashes = Strings.repeat("-", 72); log.info("Access URLs:\n{}\n\tLocal:\t\thttp://localhost:{}{}\n{}", dashes, port, contextPath, dashes); }/*from w ww. java 2s . co m*/ }
From source file:ezbake.deployer.cli.EzDeployerCli.java
public static void main(String[] args) throws TException, IOException { int returnVal = 43; try {/* ww w. j a va 2 s. c om*/ EzDeployerCli cli = new EzDeployerCli(args); try { returnVal = cli.run(); } finally { IOUtils.closeQuietly(cli); } } catch (DeploymentException e) { // A deployment exception won't be useful to print out the stack trace. System.out.println(Strings.repeat("\n", 3)); System.err.println("Error: " + e.getMessage()); System.out.println(Strings.repeat("\n", 3)); returnVal = 15; } catch (Exception e) { e.printStackTrace(); returnVal = 13; } finally { System.out.println("Finished"); } System.exit(returnVal); }
From source file:io.proleap.cobol.preprocessor.sub.util.CobolSourceFormatUtils.java
public static String getBlankComments() { return Strings.repeat(CobolPreprocessor.WS, 8); }
From source file:io.proleap.cobol.preprocessor.sub.util.CobolSourceFormatUtils.java
public static String getBlankContentArea() { return Strings.repeat(CobolPreprocessor.WS, 65); }
From source file:io.proleap.cobol.preprocessor.sub.CobolLine.java
public static String blankSequenceArea(final CobolSourceFormatEnum format) { return CobolSourceFormatEnum.TANDEM.equals(format) ? "" : Strings.repeat(CobolPreprocessor.WS, 6); }
From source file:jetbrains.jetpad.cell.indent.IndentUtil.java
public static String getIndentText(int size, int numSpaces) { String oneIndent = Strings.repeat(" ", numSpaces); return Strings.repeat(oneIndent, size); }
From source file:org.inferred.freebuilder.processor.util.testing.Diagnostics.java
/** * Appends a human-readable form of {@code diagnostic} to {@code appendable}. *//*w ww .j av a2 s .co m*/ public static void appendTo(StringBuilder appendable, Diagnostic<? extends JavaFileObject> diagnostic, int indentLevel) { String indent = "\n" + Strings.repeat(" ", indentLevel); appendable.append(diagnostic.getMessage(Locale.getDefault()).replace("\n", indent)); JavaFileObject source = diagnostic.getSource(); long line = diagnostic.getLineNumber(); if (source != null && line != Diagnostic.NOPOS) { File sourceFile = new File(source.getName()); appendable.append(" (").append(sourceFile.getName()).append(":").append(line).append(")"); } }
From source file:org.onos.yangtools.yang.data.codec.gson.JsonWriterFactory.java
/** * Create a new JsonWriter, which writes to the specified output writer. * * @param writer Output writer/* w ww . ja va 2s . c o m*/ * @param indentSize size of the indent * @return A JsonWriter instance */ public static JsonWriter createJsonWriter(Writer writer, int indentSize) { JsonWriter jsonWriter = new JsonWriter(writer); final String indent = Strings.repeat(" ", indentSize); jsonWriter.setIndent(indent); return jsonWriter; }
From source file:com.facebook.swift.parser.TreePrinter.java
private static String treeToString(Tree tree, int depth) { if (tree.getChildCount() == 0) { return tree.toString(); }/*from ww w .j a va 2 s .c o m*/ StringBuilder sb = new StringBuilder(); sb.append("("); sb.append(tree.toString()); for (Tree t : children(tree)) { if (leafCount(tree) > 2) { sb.append("\n"); sb.append(Strings.repeat(" ", depth)); } else { sb.append(" "); } sb.append(treeToString(t, depth + 1)); } sb.append(")"); return sb.toString(); }
From source file:org.shaf.shell.util.ViewUtils.java
/** * Returns a progress bar./*from ww w.j a va 2 s .c o m*/ * * @param progress * the progress indicator. * @return the progress bar. */ public static final String bar(final Progress progress) { int percent = (int) (100 * progress.getValue()); int len = (int) (PROGRESS_BAR_LENGTH * progress.getValue()); StringBuilder bar = new StringBuilder(); bar.append('['); bar.append(Strings.repeat("=", len)); bar.append(Strings.repeat(" ", 20 - len)); bar.append(Strings.repeat(" ", 3 - String.valueOf(percent).length())); bar.append(String.valueOf(percent) + "%"); bar.append(']'); bar.append(((Strings.isNullOrEmpty(progress.getMessage())) ? "" : " : " + progress.getMessage())); return bar.toString(); }