View Javadoc

1   /* This file is part of the project "Hilbert II" - http://www.qedeq.org" target="alexandria_uri">http://www.qedeq.org
2    *
3    * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU General Public License for more details.
14   */
15  
16  package org.qedeq.base.io;
17  
18  
19  /**
20   * Wraps a text output stream.
21   *
22   * @author  Michael Meyling
23   */
24  public class StringOutput extends AbstractOutput {
25  
26      /** Our buffer. */
27      private final StringBuffer output;
28  
29      /**
30       * Constructor.
31       */
32      public StringOutput() {
33          super();
34          output = new StringBuffer();
35      }
36  
37      public void append(final String text) {
38          output.append(text);
39      }
40  
41      public String toString() {
42          return output.toString();
43      }
44  
45      public long getPosition() {
46          return output.length();
47      }
48  
49  }