@Override
    public Buffer trim() {
        int initialStart = offset - length + 1;
        int initialEnd = offset;

        int start = initialStart;
        int end = initialEnd;

        while (start <= end && buffer[start] <= SPACE) {
            start++;
        }
        while (end >= start && buffer[end] <= SPACE) {
            end--;
        }

        if (start == initialStart && end == initialEnd) {
            return this;
        }

        return subSequence(initialEnd - end, end - start + 1);
    }
Create a buffer with a specified initial size.

@param initialSize The initial size of the buffer.
stroom-pipeline/src/main/java/stroom/pipeline/xml/converter/ds3/ReverseBuffer.java