public final class StringOptionUtil extends Object
StringOption
.Modifier and Type | Field and Description |
---|---|
static Charset |
ENCODING
The internal text encoding.
|
Modifier and Type | Method and Description |
---|---|
static void |
append(CharBuffer source,
StringOption destination,
CharsetEncoder encoder,
ByteBuffer buffer)
Appends source contents into the destination string.
|
static void |
append(StringBuilder target,
StringOption contents)
Appends the text in the given
StringOption into the StringBuilder . |
static void |
append(StringOption target,
String contents)
Appends the text in the second
StringOption into the first one. |
static void |
append(StringOption target,
StringOption contents)
Appends the text in the second
StringOption into the first one. |
static Reader |
asReader(StringOption option)
Returns a
Reader to read the text contents in the StringOption . |
static int |
countCodePoints(StringOption option)
Returns the number of code-points in the given
StringOption . |
static BigDecimal |
parseDecimal(StringOption contents)
Parses the given
StringOption which may represent a decimal value. |
static int |
parseInt(StringOption contents)
Parses the given
StringOption which may represent a int value. |
static long |
parseLong(StringOption contents)
Parses the given
StringOption which may represent a long value. |
static void |
trim(StringOption option)
Trims the leading/trailing classical whitespace characters in the
StringOption . |
public static final Charset ENCODING
public static int countCodePoints(StringOption option)
StringOption
.
If the object does represent neither null
nor a valid character string, this operation may raise an
error or return a wrong count.option
- the target object0
if the object represents null
NullPointerException
- if the StringOption
is/represents null
public static Reader asReader(StringOption option)
Reader
to read the text contents in the StringOption
.option
- the target StringOption
NullPointerException
- if the StringOption
is/represents null
public static void trim(StringOption option)
StringOption
.
This only removes the following characters:
"\t" (HT:U+0009)
"\n" (LF:U+000a)
"\r" (CR:U+000d)
" " (SP:U+0020)
StringOption
.option
- the target StringOption
NullPointerException
- if the StringOption
is/represents null
public static void append(StringOption target, StringOption contents)
StringOption
into the first one.
This directly modifies the first StringOption
.target
- the append targetcontents
- the text contents to be appendedNullPointerException
- if the StringOption
is/represents null
public static void append(StringOption target, String contents)
StringOption
into the first one.
This directly modifies the first StringOption
.target
- the append targetcontents
- the text contents to be appendedNullPointerException
- if the StringOption
is/represents null
public static void append(StringBuilder target, StringOption contents)
StringOption
into the StringBuilder
.target
- the append targetcontents
- the text contents to be appendedNullPointerException
- if the StringOption
is/represents null
public static int parseInt(StringOption contents)
StringOption
which may represent a int
value.contents
- the text contentsNullPointerException
- if the StringOption
is/represents null
IllegalArgumentException
- if the character sequence is wrongpublic static long parseLong(StringOption contents)
StringOption
which may represent a long
value.contents
- the text contentsNullPointerException
- if the StringOption
is/represents null
IllegalArgumentException
- if the character sequence is wrongpublic static BigDecimal parseDecimal(StringOption contents)
StringOption
which may represent a decimal value.contents
- the text contentsNullPointerException
- if the StringOption
is/represents null
IllegalArgumentException
- if the character sequence is wrongpublic static void append(CharBuffer source, StringOption destination, CharsetEncoder encoder, ByteBuffer buffer) throws CharacterCodingException
source
- the source bufferdestination
- the target StringOptionencoder
- the encoderbuffer
- the working bufferCharacterCodingException
- if error occurred while encoding source inputCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.