|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.james.mime4j.util.CharsetUtil
public class CharsetUtil
Utility class for working with character sets.
Field Summary | |
---|---|
static int |
CR
US-ASCII CR, carriage return (13) |
static java.lang.String |
CRLF
carriage return - line feed sequence |
static java.nio.charset.Charset |
DEFAULT_CHARSET
|
static int |
HT
US-ASCII HT, horizontal-tab (9) |
static java.nio.charset.Charset |
ISO_8859_1
|
static int |
LF
US-ASCII LF, line feed (10) |
static int |
SP
US-ASCII SP, space (32) |
static java.nio.charset.Charset |
US_ASCII
|
static java.nio.charset.Charset |
UTF_8
|
Constructor Summary | |
---|---|
CharsetUtil()
|
Method Summary | |
---|---|
static boolean |
isASCII(char ch)
Returns true if the specified character falls into the US
ASCII character set (Unicode range 0000 to 007f). |
static boolean |
isASCII(java.lang.String s)
Returns true if the specified string consists entirely of
US ASCII characters. |
static boolean |
isWhitespace(char ch)
Returns true if the specified character is a whitespace
character (CR, LF, SP or HT). |
static boolean |
isWhitespace(java.lang.String s)
Returns true if the specified string consists entirely of
whitespace characters. |
static java.nio.charset.Charset |
lookup(java.lang.String name)
Returns a Charset instance if character set with the given name
is recognized and supported by Java runtime. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CRLF
public static final int CR
public static final int LF
public static final int SP
public static final int HT
public static final java.nio.charset.Charset US_ASCII
public static final java.nio.charset.Charset ISO_8859_1
public static final java.nio.charset.Charset UTF_8
public static final java.nio.charset.Charset DEFAULT_CHARSET
Constructor Detail |
---|
public CharsetUtil()
Method Detail |
---|
public static boolean isASCII(char ch)
true
if the specified character falls into the US
ASCII character set (Unicode range 0000 to 007f).
ch
- character to test.
true
if the specified character falls into the US
ASCII character set, false
otherwise.public static boolean isASCII(java.lang.String s)
true
if the specified string consists entirely of
US ASCII characters.
s
- string to test.
true
if the specified string consists entirely of
US ASCII characters, false
otherwise.public static boolean isWhitespace(char ch)
true
if the specified character is a whitespace
character (CR, LF, SP or HT).
ch
- character to test.
true
if the specified character is a whitespace
character, false
otherwise.public static boolean isWhitespace(java.lang.String s)
true
if the specified string consists entirely of
whitespace characters.
s
- string to test.
true
if the specified string consists entirely of
whitespace characters, false
otherwise.public static java.nio.charset.Charset lookup(java.lang.String name)
Charset
instance if character set with the given name
is recognized and supported by Java runtime. Returns null
otherwise.
This method is a wrapper around Charset.forName(String)
method
that catches IllegalCharsetNameException
and
UnsupportedCharsetException
and returns null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |