public class CharsetUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
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 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(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. |
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
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.