class PaddingStringBuffer {
    // The buffer.
    protected StringBuffer buffer;
    // Location in current line
    protected int linePos;

    /** 
     * Create a new PaddingStringBuffer
     *
     */
    public PaddingStringBuffer() {
        buffer = new StringBuffer();
        linePos=0;
    }

    /** append a string directly to the buffer
     * @param string the string to append
     * @return This wrapped buffer w/ the passed string appended.
     */
    public PaddingStringBuffer append(String string) {<FILL_FUNCTION_BODY>}

    /**
     * Append a string, right-aligned to the given columm.  If the buffer
     * length is already greater than the column specified, it simply appends
     * the string
     *
     * @param col the column to right-align to
     * @param string the string, must not contain multiple lines.
     * @return This wrapped buffer w/ append string, right-aligned to the
     * given column.
     */
    public PaddingStringBuffer raAppend(int col, String string) {
        padTo(col-string.length());
        append(string);
        return this;
    }

    /** Pad to a given column.  If the buffer size is already greater than the
     * column, nothing is done.
     * @param col
     * @return The buffer padded to <code>i</code>.
     */
    public PaddingStringBuffer padTo(int col) {
        while(linePos<col) {
            buffer.append(" ");
            linePos++;
        }
        return this;
    }

    /** append an <code>int</code> to the buffer.
     * @param i the int to append
     * @return This wrapped buffer with <code>i</code> appended.
     */
    public PaddingStringBuffer append(int i) {
        append(Integer.toString(i));
        return this;
    }


    /**
     * Append an <code>int</code> right-aligned to the given column.  If the
     * buffer length is already greater than the column specified, it simply
     * appends the <code>int</code>.
     *
     * @param col the column to right-align to
     * @param i   the int to append
     * @return This wrapped buffer w/ appended int, right-aligned to the
     *         given column.
     */
    public PaddingStringBuffer raAppend(int col, int i) {
        return raAppend(col,Integer.toString(i));
    }

    /** append a <code>long</code> to the buffer.
     * @param lo the <code>long</code> to append
     * @return This wrapped buffer w/ appended long.
     */
    public PaddingStringBuffer append(long lo) {
        append(Long.toString(lo));
        return this;
    }

    /**Append a <code>long</code>, right-aligned to the given column.  If the
     * buffer length is already greater than the column specified, it simply
     * appends the <code>long</code>.
     * @param col the column to right-align to
     * @param lo the long to append
     * @return This wrapped buffer w/ appended long, right-aligned to the
     * given column.
     */
    public PaddingStringBuffer raAppend(int col, long lo) {
        return raAppend(col,Long.toString(lo));
    }

    /** reset the buffer back to empty */
    public void reset() {
        buffer = new StringBuffer();
        linePos = 0;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return buffer.toString();
    }

    /**
     * Forces a new line in the buffer.
     */
    public PaddingStringBuffer newline() {
        buffer.append("\n");
        linePos = 0;
        return this;
    }

}

        buffer.append(string);
        if ( string.indexOf('\n') == -1 ){
            linePos+=string.length();
        } else {
            while ( string.indexOf('\n') == -1 ){
                string = string.substring(string.indexOf('\n'));
            }
            linePos=string.length();
        }
        return this;
    
<no_super_class>