com.thoughtworks.qdox.model.IndentBuffer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.qdox
Show all versions of org.apache.servicemix.bundles.qdox
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
The newest version!
package com.thoughtworks.qdox.model;
public class IndentBuffer {
private StringBuffer buffer = new StringBuffer();
private int depth = 0;
private boolean newLine;
public void write(String s) {
checkNewLine();
buffer.append(s);
}
public void write(char s) {
checkNewLine();
buffer.append(s);
}
public void newline() {
buffer.append('\n');
newLine = true;
}
public void indent() {
depth++;
}
public void deindent() {
depth--;
}
public String toString() {
return buffer.toString();
}
private void checkNewLine() {
if (newLine) {
for (int i = 0; i < depth; i++) buffer.append('\t');
newLine = false;
}
}
}