diff options
author | Pacien TRAN-GIRARD | 2014-05-04 17:37:41 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-05-04 17:37:41 +0200 |
commit | 688634ae5a5aaf663159032e67d2132ea61c5d5f (patch) | |
tree | e0642498c904e8a9373df479239fbfc603a957d3 /src/rejava/io/StringWriter.java | |
parent | 780bae6cd1a4d2a81b8c3ed72ee5d73cee9b5ccb (diff) | |
download | esieequest-688634ae5a5aaf663159032e67d2132ea61c5d5f.tar.gz |
Implement "save" and "load"
Diffstat (limited to 'src/rejava/io/StringWriter.java')
-rw-r--r-- | src/rejava/io/StringWriter.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/rejava/io/StringWriter.java b/src/rejava/io/StringWriter.java new file mode 100644 index 0000000..cee4c97 --- /dev/null +++ b/src/rejava/io/StringWriter.java | |||
@@ -0,0 +1,29 @@ | |||
1 | package rejava.io; | ||
2 | |||
3 | /** | ||
4 | * A minimal subset of java.io.StringReader. | ||
5 | * (http://hg.openjdk.java.net/jdk7/jdk7/jdk/file | ||
6 | * /9b8c96f96a0f/src/share/classes/java/io/StringWriter.java) | ||
7 | * | ||
8 | * @author Pacien TRAN-GIRARD | ||
9 | */ | ||
10 | public class StringWriter extends Writer { | ||
11 | |||
12 | private final StringBuilder buf = new StringBuilder(); | ||
13 | |||
14 | @Override | ||
15 | public void write(final String str) { | ||
16 | this.buf.append(str); | ||
17 | } | ||
18 | |||
19 | @Override | ||
20 | public void write(final char c) { | ||
21 | this.buf.append(c); | ||
22 | } | ||
23 | |||
24 | @Override | ||
25 | public String toString() { | ||
26 | return this.buf.toString(); | ||
27 | } | ||
28 | |||
29 | } \ No newline at end of file | ||