static void print_append(Appendable _buf, S s, int max) ctex { synchronized(_buf) { _buf.append(s); if (!_buf instanceof StringBuilder) ret; StringBuilder buf = cast _buf; max /= 2; if (buf.length() > max) { try { int newLength = max/2; int ofs = buf.length()-newLength; S newString = buf.substring(ofs); buf.setLength(0); buf.append("[...] ").append(newString); } catch (Exception e) { buf.setLength(0); } buf.trimToSize(); } } }