class TitleBuffer {

    public TitleBuffer truncate(final int noWords) {
        if (noWords < 1) {
            throw new IllegalArgumentException("Truncation must be to one or more words");
        }
        int pos = 0;
        int spaces = 0;

        while (pos < title.length() && spaces < noWords) {
            if (title.charAt(pos) == ' ') {
                spaces++;
            }
            pos++;
        }
        if (pos < title.length()) {
            title.setLength(pos - 1); // string.delete(pos - 1,
            // string.length());
            title.append("...");
        }
        return this;
    }

    public  TitleBuffer();
    public  TitleBuffer(final Object object);
    public  TitleBuffer(final Object object, final String defaultTitle);
    public  TitleBuffer(final String text);

}