public class CharsetUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CR
US-ASCII CR, carriage return (13)
|
static String |
CRLF
carriage return - line feed sequence
|
static Charset |
DEFAULT_CHARSET |
static int |
HT
US-ASCII HT, horizontal-tab (9)
|
static Charset |
ISO_8859_1 |
static int |
LF
US-ASCII LF, line feed (10)
|
static int |
SP
US-ASCII SP, space (32)
|
static Charset |
US_ASCII |
static Charset |
UTF_8 |
Constructor and Description |
---|
CharsetUtil() |
Modifier and Type | Method and Description |
---|---|
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(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(String s)
Returns
true if the specified string consists entirely of
whitespace characters. |
static Charset |
lookup(String name)
Returns a
Charset instance if character set with the given name
is recognized and supported by Java runtime. |
public static final 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 Charset US_ASCII
public static final Charset ISO_8859_1
public static final Charset UTF_8
public static final Charset DEFAULT_CHARSET
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(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(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 Charset lookup(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
.Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.