StringFormatIndent


/**
* Manages an indent for multi-line messages.
*
* @author Troy T. Collinsworth
*/
public class StringFormattingIndent
{
private final StringBuilder indent = new StringBuilder();
private final String indentString;

/**
* Uses the default indent - tab.
*/
public StringFormattingIndent ()
{
this.indentString = "\t";
}

/**
* Uses a custom indent string.
*
* @param indentString
*/
public StringFormattingIndent (final String indentString)
{
this.indentString = indentString;
}

public void increment ()
{
indent.append(indentString);
}

public void decrement ()
{
indent.setLength(indent.length() - indentString.length());
}

public String getCurrentIndent ()
{
return indent.toString();
}
}

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout

Locks held on Oracle for hours after sessions abnormally terminated by node failure