I'm committing the attached patch which merges in the additions to java.io.CharArrayWriter from the generics branch.
Changelog:
2006-03-27 Andrew John Hughes <[EMAIL PROTECTED]>
* java/io/CharArrayWriter.java:
(append(char)): Documented.
(append(CharSequence)): Likewise.
(append(CharSequence,int,int)): Likewise.
2006-03-27 Tom Tromey <[EMAIL PROTECTED]>
* java/io/CharArrayWriter.java (append): New overloads.
--
Andrew :-)
Please avoid sending me Microsoft Office (e.g. Word, PowerPoint) attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
If you use Microsoft Office, support movement towards the end of vendor lock-in:
http://opendocumentfellowship.org/petition/
"Value your freedom, or you will lose it, teaches history.
`Don't bother us with politics' respond those who don't want to learn."
-- Richard Stallman
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: java/io/CharArrayWriter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/CharArrayWriter.java,v
retrieving revision 1.12
diff -u -3 -p -u -r1.12 CharArrayWriter.java
--- java/io/CharArrayWriter.java 2 Jul 2005 20:32:37 -0000 1.12
+++ java/io/CharArrayWriter.java 27 Mar 2006 21:29:01 -0000
@@ -242,6 +242,84 @@ public class CharArrayWriter extends Wri
}
}
+ /**
+ * Appends the Unicode character, <code>c</code>, to the output stream
+ * underlying this writer. This is equivalent to <code>write(c)</code>.
+ *
+ * @param c the character to append.
+ * @return a reference to this object.
+ * @since 1.5
+ */
+ public CharArrayWriter append(char c)
+ {
+ write(c);
+ return this;
+ }
+
+ /**
+ * Appends the specified sequence of Unicode characters to the
+ * output stream underlying this writer. This is equivalent to
+ * appending the results of calling <code>toString()</code> on the
+ * character sequence. As a result, the entire sequence may not be
+ * appended, as it depends on the implementation of
+ * <code>toString()</code> provided by the
+ * <code>CharSequence</code>. For example, if the character
+ * sequence is wrapped around an input buffer, the results will
+ * depend on the current position and length of that buffer.
+ *
+ * @param seq the character sequence to append. If seq is null,
+ * then the string "null" (the string representation of null)
+ * is appended.
+ * @return a reference to this object.
+ * @since 1.5
+ */
+ public CharArrayWriter append(CharSequence cs)
+ {
+ try
+ {
+ write(cs == null ? "null" : cs.toString());
+ }
+ catch (IOException _)
+ {
+ // Can't happen.
+ }
+ return this;
+ }
+
+ /**
+ * Appends the specified subsequence of Unicode characters to the
+ * output stream underlying this writer, starting and ending at the
+ * specified positions within the sequence. The behaviour of this
+ * method matches the behaviour of writing the result of
+ * <code>append(seq.subSequence(start,end))</code> when the sequence
+ * is not null.
+ *
+ * @param seq the character sequence to append. If seq is null,
+ * then the string "null" (the string representation of null)
+ * is appended.
+ * @param start the index of the first Unicode character to use from
+ * the sequence.
+ * @param end the index of the last Unicode character to use from the
+ * sequence.
+ * @return a reference to this object.
+ * @throws IndexOutOfBoundsException if either of the indices are negative,
+ * the start index occurs after the end index, or the end index is
+ * beyond the end of the sequence.
+ * @since 1.5
+ */
+ public CharArrayWriter append(CharSequence cs, int start, int end)
+ {
+ try
+ {
+ write(cs == null ? "null" : cs.subSequence(start, end).toString());
+ }
+ catch (IOException _)
+ {
+ // Can't happen.
+ }
+ return this;
+ }
+
/**
* This private method makes the buffer bigger when we run out of room
* by allocating a larger buffer and copying the valid chars from the
signature.asc
Description: Digital signature
