public interface Appendable
Known subtypesStringWriter
Declares methods to append characters or character sequences. Any class that
implements this interface can receive data formatted by a
java.util.Formatter. The appended character or character sequence
should be valid according to the rules described in
Unicode Character Representation.
Appendable itself does not guarantee thread safety. This
responsibility is up to the implementing class.
Implementing classes can choose different exception handling mechanism. They
can choose to throw exceptions other than IOException or they do not
throw any exceptions at all and use error codes instead.
Methods
Method details
append
public abstract Appendable append(char c)
throws IOExceptionParameters
cchar- the character to append.
Returns
Appendable.Throws
IOException- if an I/O error occurs.
append
public abstract Appendable append(CharSequence csq)
throws IOExceptionAppends the character sequence csq. Implementation classes may
not append the whole sequence, for example if the target is a buffer with
limited size.
If csq is null, the characters “null” are appended.
Parameters
csqCharSequence- the character sequence to append.
Returns
Appendable.Throws
IOException- if an I/O error occurs.
append
public abstract Appendable append(CharSequence csq, int start, int end)
throws IOExceptionAppends a subsequence of csq.
If csq is not null then calling this method is equivalent
to calling append(csq.subSequence(start, end)).
If csq is null, the characters “null” are appended.
Parameters
csqCharSequence- the character sequence to append.
startint- the first index of the subsequence of
csqthat is appended. endint- the last index of the subsequence of
csqthat is appended.
Returns
Appendable.Throws
IndexOutOfBoundsException- if
start endorendis greater than the length ofcsq. IOException- if an I/O error occurs.