private void escape(final char c) {
        switch (c) {
            case '\r':
                // Ignore carriage returns.
                break;
            case '<':
                output.append(LT);
                break;
            case '>':
                // Convert < to &gt;.
                output.append(GT);
                break;
            case '&':
                // Convert & to &amp;.
                output.append(AMP);
                break;
            default:
                output.append(c);
        }
    }
Reduces the current length of a <code>StringBuilder</code> to trim any
whitespace off the end of the buffer.

@param sb The <code>StringBuilder</code> to trim.
stroom-core-client-widget/src/main/java/stroom/editor/client/model/XMLStyler.java