aboutsummaryrefslogtreecommitdiff
path: root/src/rejava/io/StringWriter.java
blob: cee4c97178d3ef90905b267a37b95a54b7242eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package rejava.io;

/**
 * A minimal subset of java.io.StringReader.
 * (http://hg.openjdk.java.net/jdk7/jdk7/jdk/file
 * /9b8c96f96a0f/src/share/classes/java/io/StringWriter.java)
 * 
 * @author Pacien TRAN-GIRARD
 */
public class StringWriter extends Writer {

	private final StringBuilder buf = new StringBuilder();

	@Override
	public void write(final String str) {
		this.buf.append(str);
	}

	@Override
	public void write(final char c) {
		this.buf.append(c);
	}

	@Override
	public String toString() {
		return this.buf.toString();
	}

}