/** * Left pad a String with a specified string. Pad to a size of n. * * @param str String to pad out * @param size size to pad to * @param delim String to pad with * @return left padded String * @throws NullPointerException if str or delim is null * @throws ArithmeticException if delim is the empty string */ public static String leftPad( String str, int size, String delim ) { size = ( size - str.length() ) / delim.length(); if ( size > 0 ) { str = repeat( delim, size ) + str; } return str; }
/** * <p> * Right pad a String with a specified string. * </p> * <p> * The String is padded to the size of <code>n</code>. * </p> * * @param str String to pad out * @param size size to pad to * @param delim String to pad with * @return right padded String * @throws NullPointerException if str or delim is <code>null</code> * @throws ArithmeticException if delim is the empty String */ public static String rightPad( String str, int size, String delim ) { size = ( size - str.length() ) / delim.length(); if ( size > 0 ) { str += repeat( delim, size ); } return str; }
/** * Convenience method to write XML comment line break with <code>columnSize</code> as length. * * @param writer not null * @param columnSize positive number */ public static void writeCommentLineBreak( XMLWriter writer, int columnSize ) { if ( columnSize < 10 ) { columnSize = DEFAULT_COLUMN_LINE; } writer.writeMarkup( "<!-- " + StringUtils.repeat( "=", columnSize - 10 ) + " -->" + LS ); }
/** * Convenience method to repeat <code>CRLF</code> and to indent the writer by <code>indentSize</code>. * * @param writer not null * @param repeat * @param indent positive number * @param indentSize positive number */ public static void writeLineBreak( XMLWriter writer, int repeat, int indent, int indentSize ) { writeLineBreak( writer, repeat ); if ( indent < 0 ) { indent = 0; } if ( indentSize < 0 ) { indentSize = 0; } writer.writeText( StringUtils.repeat( " ", indent * indentSize ) ); }
String indentation = StringUtils.repeat( " ", indent * indentSize ); int magicNumber = indentation.length() + columnSize - "-->".length() - 1; String[] sentences = StringUtils.split( comment, LS ); line.append( StringUtils.repeat( " ", magicNumber - line.length() ) ); line.append( StringUtils.repeat( " ", magicNumber - line.length() ) ); line.append( StringUtils.repeat( " ", magicNumber - line.length() ) );
xmlWriter.setLineIndenter( StringUtils.repeat( " ", indentSize ) ); xmlWriter.setLineSeparator( lineSeparator );
xmlWriter.setLineIndenter( StringUtils.repeat( " ", indentSize ) ); xmlWriter.setLineSeparator( lineSeparator );
public LogMatrixPrinter(Log logger, int indent) { this.log = logger; sep = StringUtils.repeat(" ", indent); }
public static String clean( String string ) { if ( string.indexOf( " -P " ) == -1 ) { return string; } int idx = string.indexOf( " -P " ) + 4; int end = string.indexOf( ' ', idx ); return string.substring( 0, idx ) + StringUtils.repeat( "*", end - idx ) + string.substring( end ); }
public static String clean( String string ) { if ( string.indexOf( " -P " ) == -1 ) { return string; } int idx = string.indexOf( " -P " ) + 4; int end = string.indexOf( ' ', idx ); return string.substring( 0, idx ) + StringUtils.repeat( "*", end - idx ) + string.substring( end ); }
/** {@inheritDoc} */ public void listItem() { String indent = StringUtils.repeat( THREE_SPACES_MARKUP, levelList ); write( indent + LIST_ITEM_MARKUP ); }
public void printHeader(List<ArtifactRepository> repositories) { log.info(""); log.info("dependencies, and where they are available:"); final int repCount = repositories.size(); for (int i = 0; i < repCount; i++) { final ArtifactRepository rep = repositories.get(i); log.info(String.format("%s%s (%s)", StringUtils.repeat("|" + sep, i), rep.getId(), rep.getUrl())); } log.info(StringUtils.repeat("|" + sep, repCount)); }
public void printFooter(List<ArtifactRepository> repositories) { final int repCount = repositories.size(); log.info(StringUtils.repeat("|" + sep, repCount)); for (int i = repCount - 1; i >= 0; i--) { final ArtifactRepository rep = repositories.get(i); log.info(String.format("%s%s (%s)", StringUtils.repeat("|" + sep, i), rep.getId(), rep.getUrl())); } log.info(""); }
/** {@inheritDoc} */ public void listItem() { write( StringUtils.repeat( "*", levelList ) + " " ); }
/** {@inheritDoc} */ public void numberedListItem() { writeEOL( true ); String style = (String) listStyles.peek(); String indent = StringUtils.repeat( THREE_SPACES_MARKUP, levelList ); write( indent + style + SPACE ); }
public String toString() { StringBuilder buff = new StringBuilder( "AccuRevScmProviderRepository" ); buff.append( " user=" ); buff.append( getUser() ); buff.append( " pass=" ); buff.append( getPassword() == null ? "null" : StringUtils.repeat( "*", getPassword().length() ) ); buff.append( " host=" ); buff.append( getHost() ); buff.append( " port=" ); buff.append( getPort() ); buff.append( " stream=" ); buff.append( getStreamName() ); buff.append( " projectPath=" ); buff.append( getProjectPath() ); return buff.toString(); }
public String toString() { StringBuilder buff = new StringBuilder( "AccuRevScmProviderRepository" ); buff.append( " user=" ); buff.append( getUser() ); buff.append( " pass=" ); buff.append( getPassword() == null ? "null" : StringUtils.repeat( "*", getPassword().length() ) ); buff.append( " host=" ); buff.append( getHost() ); buff.append( " port=" ); buff.append( getPort() ); buff.append( " stream=" ); buff.append( getStreamName() ); buff.append( " projectPath=" ); buff.append( getProjectPath() ); return buff.toString(); }
private void print( int i, LineFile lines, Stream<Tree<PackageFileSystemObject<A>>> children ) { String indent = StringUtils.repeat( " ", i ); i++; for ( Tree<PackageFileSystemObject<A>> child : children ) { lines.add( indent + child.root().getUnixFsObject().path.name() ); print( i, lines, child.subForest()._1() ); } } }