public class StringAppendableExt extends AppendableExt
In the event that an underlying Appendable is used which does actually
thrown IOExceptions, they will be trapped, and at any time the last
IOException can be obtained using getIOException()
.
This class is not thread-safe.
Constructor and Description |
---|
StringAppendableExt()
Initialize a new StringAppendableExt based on a StringBuilder.
|
StringAppendableExt(Appendable app)
Initialize a new StringAppendableExt based on the given Appendable.
|
StringAppendableExt(Appendable app,
Object context)
Initialize a new StringAppendableExt based on the given Appendable and
context.
|
StringAppendableExt(int capacity)
Initialize a new StringAppendableExt based on a StringBuilder, with a
specified initial capacity.
|
StringAppendableExt(int size,
Object context)
Initialize a new StringAppendableExt based on a StringBuilder, with a
specified initial capacity and given context.
|
Modifier and Type | Method and Description |
---|---|
StringAppendableExt |
append(Appendee a)
Will call the appendTo() method on the given object.
|
StringAppendableExt |
append(char c) |
StringAppendableExt |
append(CharSequence s) |
StringAppendableExt |
append(CharSequence s,
int start,
int end) |
StringAppendableExt |
append(Iterable<?> iable,
Object delimiter)
Will iterate the given Iterable and append each object separated by the
given delimiter.
|
StringAppendableExt |
append(Object o)
Will call append(String.valueOf(o)) with the given object (unless the
object is an Appendee or CharSequence in which case it will be passed to
the appropriate method).
|
IOException |
getIOException()
Get the last IOException thrown by an append call, or
null if
no IOException was caught. |
getAppendable, getContext, setContext, toString
public StringAppendableExt()
public StringAppendableExt(int capacity)
capacity
- the initial capacity for the StringBuilder.public StringAppendableExt(int size, Object context)
size
- the initial capacity for the StringBuilder.context
- initial append contextpublic StringAppendableExt(Appendable app)
app
- initial underlying Appendablepublic StringAppendableExt(Appendable app, Object context)
app
- initial underlying Appendablecontext
- initial append contextpublic StringAppendableExt append(char c)
append
in interface Appendable
append
in class AppendableExt
public StringAppendableExt append(CharSequence s)
AppendableExt
Note that if the given CharSequence is also an Appendee, it will be handled as an Appendee instead.
append
in interface Appendable
append
in class AppendableExt
public StringAppendableExt append(CharSequence s, int start, int end)
AppendableExt
Note that if the given CharSequence is also an Appendee, it will be handled as an Appendee instead (but the range will still be respected).
append
in interface Appendable
append
in class AppendableExt
public StringAppendableExt append(Appendee a)
AppendableExt
append
in class AppendableExt
a
- object to append to this AppendableExtpublic StringAppendableExt append(Object o)
AppendableExt
append
in class AppendableExt
o
- object to append to this AppendableExtpublic StringAppendableExt append(Iterable<?> iable, Object delimiter)
AppendableExt
append
in class AppendableExt
iable
- an Iterable objectdelimiter
- delimiter to append between each object in the iablepublic IOException getIOException()
null
if
no IOException was caught.null
if no IOException was caught.Copyright © 2006–2021 OpenHMS. All rights reserved.