package org.spoofax.interpreter.terms;

public class InlinePrinter implements ITermPrinter {
	String out;
	
	public InlinePrinter() {
		out = "";
	}
	
	public String getString() {
		return out;
	}

	public void print(String string) {
		if (string.matches("^ *$")) {
			return ;
		}
		out += string;
	}

	public void indent(int i) {
	}

	public void nextIndentOff() {
	}

	public void outdent(int i) {
	}

	public void println(String string, boolean b) {
		if (string.matches("^ *$")) {
			return ;
		}
		out += string;
	}

	public void println(String string) {
		out += string;
	}
}

@@ -93,22 +93,28 @@
 %0A%09String
+Buffer
  out;%0A
-
 %09%0A%09publi
@@ -145,10 +145,26 @@
 t = 
-%22%22
+new StringBuffer()
 ;%0A%09%7D
@@ -207,16 +207,27 @@
 turn out
+.toString()
 ;%0A%09%7D%0A%0A%09p
@@ -309,34 +309,39 @@
  ;%0A%09%09%7D%0A%09%09out
- += 
+.append(
 string
+)
 ;%0A%09%7D%0A%0A%09publi
@@ -534,34 +534,39 @@
  ;%0A%09%09%7D%0A%09%09out
- += 
+.append(
 string
+)
 ;%0A%09%7D%0A%0A%09publi
@@ -606,18 +606,23 @@
 %09out
- += 
+.append(
 string
+)
 ;%0A%09%7D

Use StringBuffer to avoid string concatenation while inline printing.