diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-05-18 17:29:21 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-05-18 17:29:21 +0000 |
commit | 4f9533c7722fa07511a94d005227961f4a4dec23 (patch) | |
tree | 9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/java/io/CharArrayWriter.java | |
parent | eaec4980e139903ae9b274d1abcf3a13946603a8 (diff) | |
download | gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.gz |
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
Diffstat (limited to 'libjava/classpath/java/io/CharArrayWriter.java')
-rw-r--r-- | libjava/classpath/java/io/CharArrayWriter.java | 78 |
1 files changed, 78 insertions, 0 deletions
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, <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 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 + * <code>append(cs.subSequence(start,end))</code> 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 |