|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.healthmarketscience.common.util.AppendableExt
com.healthmarketscience.common.util.StringAppendableExt
public class StringAppendableExt
Simple extension of AppendableExt that swallows IOExceptions under the assumption that it will generally be used with Appendables which do not actually throw any IOExceptions (i.e. StringBuilder). Default constructors will use a StringBuilder for the underlying Appendable.
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 Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class com.healthmarketscience.common.util.AppendableExt |
---|
getAppendable, getContext, setContext, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 contextMethod Detail |
---|
public 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 AppendableExt
public StringAppendableExt append(Object o)
AppendableExt
append
in class AppendableExt
o
- object to append to this AppendableExt
public StringAppendableExt append(Iterable<?> iable, Object delimiter)
AppendableExt
append
in class AppendableExt
iable
- an Iterable objectdelimiter
- delimiter to append between each object in the iable
public IOException getIOException()
null
if
no IOException was caught.
null
if no IOException was caught.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |