writer.println(); currentLength = 0; lastWasNewline = true;
if (! lastWasNewline) { writer.println(); currentLength = 0; lastWasNewline = true; }
    private void flushBuffer (StringBuffer buf)    {        // Ask the StringTokenizer to return the delimiters, too. That way,        // empty lines are not skipped. Otherwise, the StringTokenizer will        // parse through multiple adjacent delimiters, causing empty lines        // to be swallowed.        StringTokenizer lineTok = new StringTokenizer (buf.toString(),                                                       "" + NEWLINE_MARKER,                                                       true);        String localPrefix = (prefix == null) ? "" : prefix;        int currentLength = 0;        boolean lastWasNewline = true;        while (lineTok.hasMoreTokens())        {            String line = lineTok.nextToken();            if ((line.length() == 1) && (line.charAt (0) == NEWLINE_MARKER))            {                // Newline. Process and go back for more.                writer.println();                lastWasNewline = true;                currentLength = 0;                continue;            }            StringTokenizer wordTok = new StringTokenizer (line);            // Process this line's worth of tokens.            while (wordTok.hasMoreTokens())            {                String word = wordTok.nextToken();                int wordLength = word.length();                // If the word (plus a delimiting space) exceeds the line                // length, wrap now.                if ((wordLength + currentLength + 1) > this.lineLength)                {                    writer.println();                    currentLength = 0;                    lastWasNewline = true;                }                if (lastWasNewline)                {                    // indent() handles both the prefix and the indentation.                    currentLength += indent();                    lastWasNewline = false;                }                else                {                    writer.print (' ');                    currentLength += 1;                }                writer.print (word);                currentLength += wordLength;            }        }        if (currentLength > 0)            writer.println();        writer.flush();    }