From 4f9533c7722fa07511a94d005227961f4a4dec23 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 18 May 2006 17:29:21 +0000 Subject: Imported GNU Classpath 0.90 Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887 --- libjava/classpath/java/io/CharArrayWriter.java | 78 ++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'libjava/classpath/java/io/CharArrayWriter.java') diff --git a/libjava/classpath/java/io/CharArrayWriter.java b/libjava/classpath/java/io/CharArrayWriter.java index f9b338fe0cc..68e693b4a1a 100644 --- a/libjava/classpath/java/io/CharArrayWriter.java +++ b/libjava/classpath/java/io/CharArrayWriter.java @@ -242,6 +242,84 @@ public class CharArrayWriter extends Writer } } + /** + * Appends the Unicode character, c, to the output stream + * underlying this writer. This is equivalent to write(c). + * + * @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 toString() on the + * character sequence. As a result, the entire sequence may not be + * appended, as it depends on the implementation of + * toString() provided by the + * CharSequence. 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 cs the character sequence to append. If cs 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 + * append(cs.subSequence(start,end)) when the sequence + * is not null. + * + * @param cs the character sequence to append. If cs 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 -- cgit v1.2.3