1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Appendable.java Tue Feb 26 16:54:16 2013 +0100
1.3 @@ -0,0 +1,121 @@
1.4 +/*
1.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.7 + *
1.8 + * This code is free software; you can redistribute it and/or modify it
1.9 + * under the terms of the GNU General Public License version 2 only, as
1.10 + * published by the Free Software Foundation. Oracle designates this
1.11 + * particular file as subject to the "Classpath" exception as provided
1.12 + * by Oracle in the LICENSE file that accompanied this code.
1.13 + *
1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.17 + * version 2 for more details (a copy is included in the LICENSE file that
1.18 + * accompanied this code).
1.19 + *
1.20 + * You should have received a copy of the GNU General Public License version
1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.23 + *
1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.25 + * or visit www.oracle.com if you need additional information or have any
1.26 + * questions.
1.27 + */
1.28 +
1.29 +package java.lang;
1.30 +
1.31 +import java.io.IOException;
1.32 +
1.33 +/**
1.34 + * An object to which <tt>char</tt> sequences and values can be appended. The
1.35 + * <tt>Appendable</tt> interface must be implemented by any class whose
1.36 + * instances are intended to receive formatted output from a {@link
1.37 + * java.util.Formatter}.
1.38 + *
1.39 + * <p> The characters to be appended should be valid Unicode characters as
1.40 + * described in <a href="Character.html#unicode">Unicode Character
1.41 + * Representation</a>. Note that supplementary characters may be composed of
1.42 + * multiple 16-bit <tt>char</tt> values.
1.43 + *
1.44 + * <p> Appendables are not necessarily safe for multithreaded access. Thread
1.45 + * safety is the responsibility of classes that extend and implement this
1.46 + * interface.
1.47 + *
1.48 + * <p> Since this interface may be implemented by existing classes
1.49 + * with different styles of error handling there is no guarantee that
1.50 + * errors will be propagated to the invoker.
1.51 + *
1.52 + * @since 1.5
1.53 + */
1.54 +public interface Appendable {
1.55 +
1.56 + /**
1.57 + * Appends the specified character sequence to this <tt>Appendable</tt>.
1.58 + *
1.59 + * <p> Depending on which class implements the character sequence
1.60 + * <tt>csq</tt>, the entire sequence may not be appended. For
1.61 + * instance, if <tt>csq</tt> is a {@link java.nio.CharBuffer} then
1.62 + * the subsequence to append is defined by the buffer's position and limit.
1.63 + *
1.64 + * @param csq
1.65 + * The character sequence to append. If <tt>csq</tt> is
1.66 + * <tt>null</tt>, then the four characters <tt>"null"</tt> are
1.67 + * appended to this Appendable.
1.68 + *
1.69 + * @return A reference to this <tt>Appendable</tt>
1.70 + *
1.71 + * @throws IOException
1.72 + * If an I/O error occurs
1.73 + */
1.74 + Appendable append(CharSequence csq) throws IOException;
1.75 +
1.76 + /**
1.77 + * Appends a subsequence of the specified character sequence to this
1.78 + * <tt>Appendable</tt>.
1.79 + *
1.80 + * <p> An invocation of this method of the form <tt>out.append(csq, start,
1.81 + * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
1.82 + * exactly the same way as the invocation
1.83 + *
1.84 + * <pre>
1.85 + * out.append(csq.subSequence(start, end)) </pre>
1.86 + *
1.87 + * @param csq
1.88 + * The character sequence from which a subsequence will be
1.89 + * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
1.90 + * will be appended as if <tt>csq</tt> contained the four
1.91 + * characters <tt>"null"</tt>.
1.92 + *
1.93 + * @param start
1.94 + * The index of the first character in the subsequence
1.95 + *
1.96 + * @param end
1.97 + * The index of the character following the last character in the
1.98 + * subsequence
1.99 + *
1.100 + * @return A reference to this <tt>Appendable</tt>
1.101 + *
1.102 + * @throws IndexOutOfBoundsException
1.103 + * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
1.104 + * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
1.105 + * <tt>csq.length()</tt>
1.106 + *
1.107 + * @throws IOException
1.108 + * If an I/O error occurs
1.109 + */
1.110 + Appendable append(CharSequence csq, int start, int end) throws IOException;
1.111 +
1.112 + /**
1.113 + * Appends the specified character to this <tt>Appendable</tt>.
1.114 + *
1.115 + * @param c
1.116 + * The character to append
1.117 + *
1.118 + * @return A reference to this <tt>Appendable</tt>
1.119 + *
1.120 + * @throws IOException
1.121 + * If an I/O error occurs
1.122 + */
1.123 + Appendable append(char c) throws IOException;
1.124 +}