author | simonis |
Fri, 14 Aug 2015 10:35:45 +0200 | |
changeset 32209 | 24bb680a1609 |
parent 32033 | bf24e33c7919 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.lang; |
|
27 |
||
28 |
import java.io.IOException; |
|
29 |
||
30 |
/** |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
31 |
* An object to which {@code char} sequences and values can be appended. The |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
32 |
* {@code Appendable} interface must be implemented by any class whose |
2 | 33 |
* instances are intended to receive formatted output from a {@link |
34 |
* java.util.Formatter}. |
|
35 |
* |
|
36 |
* <p> The characters to be appended should be valid Unicode characters as |
|
37 |
* described in <a href="Character.html#unicode">Unicode Character |
|
38 |
* Representation</a>. Note that supplementary characters may be composed of |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
39 |
* multiple 16-bit {@code char} values. |
2 | 40 |
* |
41 |
* <p> Appendables are not necessarily safe for multithreaded access. Thread |
|
42 |
* safety is the responsibility of classes that extend and implement this |
|
43 |
* interface. |
|
44 |
* |
|
45 |
* <p> Since this interface may be implemented by existing classes |
|
46 |
* with different styles of error handling there is no guarantee that |
|
47 |
* errors will be propagated to the invoker. |
|
48 |
* |
|
49 |
* @since 1.5 |
|
50 |
*/ |
|
51 |
public interface Appendable { |
|
52 |
||
53 |
/** |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
54 |
* Appends the specified character sequence to this {@code Appendable}. |
2 | 55 |
* |
56 |
* <p> Depending on which class implements the character sequence |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
57 |
* {@code csq}, the entire sequence may not be appended. For |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
58 |
* instance, if {@code csq} is a {@link java.nio.CharBuffer} then |
2 | 59 |
* the subsequence to append is defined by the buffer's position and limit. |
60 |
* |
|
61 |
* @param csq |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
62 |
* The character sequence to append. If {@code csq} is |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
63 |
* {@code null}, then the four characters {@code "null"} are |
2 | 64 |
* appended to this Appendable. |
65 |
* |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
66 |
* @return A reference to this {@code Appendable} |
2 | 67 |
* |
68 |
* @throws IOException |
|
69 |
* If an I/O error occurs |
|
70 |
*/ |
|
71 |
Appendable append(CharSequence csq) throws IOException; |
|
72 |
||
73 |
/** |
|
74 |
* Appends a subsequence of the specified character sequence to this |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
75 |
* {@code Appendable}. |
2 | 76 |
* |
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
77 |
* <p> An invocation of this method of the form {@code out.append(csq, start, end)} |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
78 |
* when {@code csq} is not {@code null}, behaves in |
2 | 79 |
* exactly the same way as the invocation |
80 |
* |
|
81 |
* <pre> |
|
82 |
* out.append(csq.subSequence(start, end)) </pre> |
|
83 |
* |
|
84 |
* @param csq |
|
85 |
* The character sequence from which a subsequence will be |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
86 |
* appended. If {@code csq} is {@code null}, then characters |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
87 |
* will be appended as if {@code csq} contained the four |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
88 |
* characters {@code "null"}. |
2 | 89 |
* |
90 |
* @param start |
|
91 |
* The index of the first character in the subsequence |
|
92 |
* |
|
93 |
* @param end |
|
94 |
* The index of the character following the last character in the |
|
95 |
* subsequence |
|
96 |
* |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
97 |
* @return A reference to this {@code Appendable} |
2 | 98 |
* |
99 |
* @throws IndexOutOfBoundsException |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
100 |
* If {@code start} or {@code end} are negative, {@code start} |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
101 |
* is greater than {@code end}, or {@code end} is greater than |
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
102 |
* {@code csq.length()} |
2 | 103 |
* |
104 |
* @throws IOException |
|
105 |
* If an I/O error occurs |
|
106 |
*/ |
|
107 |
Appendable append(CharSequence csq, int start, int end) throws IOException; |
|
108 |
||
109 |
/** |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
110 |
* Appends the specified character to this {@code Appendable}. |
2 | 111 |
* |
112 |
* @param c |
|
113 |
* The character to append |
|
114 |
* |
|
32033
bf24e33c7919
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents:
25859
diff
changeset
|
115 |
* @return A reference to this {@code Appendable} |
2 | 116 |
* |
117 |
* @throws IOException |
|
118 |
* If an I/O error occurs |
|
119 |
*/ |
|
120 |
Appendable append(char c) throws IOException; |
|
121 |
} |