/* $Id: TextOutput.java,v 1.1 2006/10/20 20:23:05 m31 Exp $
 *
 * This file is part of the project "Hilbert II" - http://www.qedeq.org
 *
 * Copyright 2000-2006,  Michael Meyling <mime@qedeq.org>.
 *
 * "Hilbert II" is free software; you can redistribute
 * it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

package org.qedeq.kernel.parser;

import java.io.PrintStream;

/**
 * Wraps a text output stream.
 *
 * @version $Revision: 1.1 $
 * @author  Michael Meyling
 */
public final class TextOutput {

    /** Wrapped stream. */
    private PrintStream output;

    /**
     * Constructor.
     *
     * @param   output  Write to this output.
     */
    public TextOutput(final PrintStream output) {
        this.output =  output;
    }

    /**
     * Print text to output. TODO mime 20061003: and to System.out
     *
     * @param   text    Append this.
     */
    public void print(final String text) {
        output.print(text);
        System.out.print(text);
    }

    /**
     * Print object to output. TODO mime 20061003: and to System.out
     *
     * @param   object  Append text representation of this.
     */
    public void print(final Object object) {
        output.print(object);
        System.out.print(object);
    }

    /**
     * Print text and new line to output. TODO mime 20061003: and to System.out
     *
     * @param   line    Append this.
     */
    public final void println(final String line) {
        output.println(line);
        System.out.println(line);
    }

    /**
     * Print object and new line to output. TODO mime 20061003: and to System.out
     *
     * @param   object  Append text representation of this.
     */
    public final void println(final Object object) {
        output.println(object);
        System.out.println(object);
    }

    /**
     * Print new line to output. TODO mime 20061003: and to System.out
     */
    public final void println() {
        output.println();
        System.out.println();
    }

    /**
     * Close output.
     */
    public final void close() {
        output.close();
    }

}
