18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.io;
27
28
29 /**
30 * A character stream that collects its output in a string buffer, which can
31 * then be used to construct a string.
32 * <p>
33 * Closing a <tt>StringWriter</tt> has no effect. The methods in this class
34 * can be called after the stream has been closed without generating an
35 * <tt>IOException</tt>.
36 *
37 * @author Mark Reinhold
38 * @since JDK1.1
39 */
40
41 public class StringWriter extends Writer {
42
43 private StringBuffer buf;
44
45 /**
46 * Create a new string writer using the default initial string-buffer
47 * size.
48 */
49 public StringWriter() {
50 buf = new StringBuffer();
51 lock = buf;
52 }
53
54 /**
55 * Create a new string writer using the specified initial string-buffer
56 * size.
57 *
58 * @param initialSize
|
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.io;
27
28
29 /**
30 * A character stream that collects its output in a string buffer, which can
31 * then be used to construct a string.
32 * <p>
33 * Closing a <tt>StringWriter</tt> has no effect. The methods in this class
34 * can be called after the stream has been closed without generating an
35 * <tt>IOException</tt>.
36 *
37 * @author Mark Reinhold
38 * @since 1.1
39 */
40
41 public class StringWriter extends Writer {
42
43 private StringBuffer buf;
44
45 /**
46 * Create a new string writer using the default initial string-buffer
47 * size.
48 */
49 public StringWriter() {
50 buf = new StringBuffer();
51 lock = buf;
52 }
53
54 /**
55 * Create a new string writer using the specified initial string-buffer
56 * size.
57 *
58 * @param initialSize
|