add basic python writer for bmap binding

This commit is contained in:
2023-11-02 22:02:39 +08:00
parent bcd58af132
commit 52c2d3f7e0
9 changed files with 260 additions and 6 deletions

View File

@ -0,0 +1,42 @@
import java.io.OutputStreamWriter;
public class IndentHelper {
public IndentHelper(OutputStreamWriter writer) {
mIndent = 0;
mWriter = writer;
}
private int mIndent;
private OutputStreamWriter mWriter;
public void inc() {
++mIndent;
}
public void dec() {
--mIndent;
}
private void indent() throws Exception {
for (int i = 0; i < mIndent; ++i) {
mWriter.write(" ");
}
}
private void lineBreak() throws Exception {
mWriter.write(System.lineSeparator());
}
public void puts(String data) throws Exception {
indent();
mWriter.write(data);
lineBreak();
}
public void printf(String fmt, Object... args) throws Exception {
indent();
mWriter.write(String.format(fmt, args));
lineBreak();
}
}