code: synchronized void printBuffer() throws IOException { // TODO: is synchronized really needed here?
  	int len = sb.length();
  	if (len > 0) {
  	    char[] chars = new char[len];
  	    sb.getChars(0, len, chars, 0);
  	    sb.setLength(0);
  	    super.write(chars, 0, chars.length);
  	}
      }
docs: prints the characters from the buffer and resets it
  
  TODO: make sure that printBuffer() is called at the end of the stream in case we have some
  characters there! (flush() ?)