public void setLength(final int len) {
        if (len < 0 || len > buffer.length) {
            throw new IndexOutOfBoundsException();
        }

        length = len;
    }
Sets the length of the string to a certain size. This will effectively
trim the string if the length specified is less than the current length.
If the length is greater than the current length then more characters
will be included from the underlying buffer.
stroom-util/src/test/java/stroom/util/xml/RingBuffer.java