|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
TextOutput.java | - | 0% | 0% | 0% |
|
1 | /* $Id: TextOutput.java,v 1.1 2006/10/20 20:23:05 m31 Exp $ | |
2 | * | |
3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
4 | * | |
5 | * Copyright 2000-2006, Michael Meyling <mime@qedeq.org>. | |
6 | * | |
7 | * "Hilbert II" is free software; you can redistribute | |
8 | * it and/or modify it under the terms of the GNU General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2 of the License, or (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | */ | |
17 | ||
18 | package org.qedeq.kernel.parser; | |
19 | ||
20 | import java.io.PrintStream; | |
21 | ||
22 | /** | |
23 | * Wraps a text output stream. | |
24 | * | |
25 | * @version $Revision: 1.1 $ | |
26 | * @author Michael Meyling | |
27 | */ | |
28 | public final class TextOutput { | |
29 | ||
30 | /** Wrapped stream. */ | |
31 | private PrintStream output; | |
32 | ||
33 | /** | |
34 | * Constructor. | |
35 | * | |
36 | * @param output Write to this output. | |
37 | */ | |
38 | 0 | public TextOutput(final PrintStream output) { |
39 | 0 | this.output = output; |
40 | } | |
41 | ||
42 | /** | |
43 | * Print text to output. TODO mime 20061003: and to System.out | |
44 | * | |
45 | * @param text Append this. | |
46 | */ | |
47 | 0 | public void print(final String text) { |
48 | 0 | output.print(text); |
49 | 0 | System.out.print(text); |
50 | } | |
51 | ||
52 | /** | |
53 | * Print object to output. TODO mime 20061003: and to System.out | |
54 | * | |
55 | * @param object Append text representation of this. | |
56 | */ | |
57 | 0 | public void print(final Object object) { |
58 | 0 | output.print(object); |
59 | 0 | System.out.print(object); |
60 | } | |
61 | ||
62 | /** | |
63 | * Print text and new line to output. TODO mime 20061003: and to System.out | |
64 | * | |
65 | * @param line Append this. | |
66 | */ | |
67 | 0 | public final void println(final String line) { |
68 | 0 | output.println(line); |
69 | 0 | System.out.println(line); |
70 | } | |
71 | ||
72 | /** | |
73 | * Print object and new line to output. TODO mime 20061003: and to System.out | |
74 | * | |
75 | * @param object Append text representation of this. | |
76 | */ | |
77 | 0 | public final void println(final Object object) { |
78 | 0 | output.println(object); |
79 | 0 | System.out.println(object); |
80 | } | |
81 | ||
82 | /** | |
83 | * Print new line to output. TODO mime 20061003: and to System.out | |
84 | */ | |
85 | 0 | public final void println() { |
86 | 0 | output.println(); |
87 | 0 | System.out.println(); |
88 | } | |
89 | ||
90 | /** | |
91 | * Close output. | |
92 | */ | |
93 | 0 | public final void close() { |
94 | 0 | output.close(); |
95 | } | |
96 | ||
97 | } |
|