public final class CharsetInfo
extends java.lang.Object
Note: Only one CharsetInfo instance exists per charset.
This allows simple equality comparisons between instances retrieved with any
of the get methods.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
charset
The Java character set name.
|
private static java.util.HashMap |
charsets
Server charset to Java charset map.
|
private static java.lang.String |
CHARSETS_RESOURCE_NAME
Name of the
Charsets.properties resource. |
private static java.util.HashMap |
lcidToCharsetMap
Locale id to Java charset map.
|
private static CharsetInfo[] |
sortToCharsetMap
Sort order to Java charset map.
|
private boolean |
wideChars
Indicates whether current charset is wide (ie multi-byte).
|
| Constructor and Description |
|---|
CharsetInfo(java.lang.String descriptor)
Constructs a
CharsetInfo object from a character set
descriptor of the form: charset preceded by a numeric value indicating
whether it's a multibyte character set (>1) or not (1) and a vertical
bar (|), eg "1|Cp1252" or "2|MS936". |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getCharset()
Retrieves the charset name.
|
static CharsetInfo |
getCharset(byte[] collation)
Retrieves the
CharsetInfo instance asociated with the
specified collation. |
static CharsetInfo |
getCharset(java.lang.String serverCharset)
Retrieves the
CharsetInfo instance asociated with the
specified server charset. |
static CharsetInfo |
getCharsetForLCID(int lcid)
Retrieves the
CharsetInfo instance asociated with the
specified LCID. |
static CharsetInfo |
getCharsetForSortOrder(int sortOrder)
Retrieves the
CharsetInfo instance asociated with the
specified sort order. |
int |
hashCode() |
boolean |
isWideChars()
Retrieves whether the caracter set is wide (ie multi-byte).
|
java.lang.String |
toString() |
private static final java.lang.String CHARSETS_RESOURCE_NAME
Charsets.properties resource.private static final java.util.HashMap charsets
private static final java.util.HashMap lcidToCharsetMap
private static final CharsetInfo[] sortToCharsetMap
private final java.lang.String charset
private final boolean wideChars
public CharsetInfo(java.lang.String descriptor)
CharsetInfo object from a character set
descriptor of the form: charset preceded by a numeric value indicating
whether it's a multibyte character set (>1) or not (1) and a vertical
bar (|), eg "1|Cp1252" or "2|MS936".descriptor - the charset descriptorpublic static CharsetInfo getCharset(java.lang.String serverCharset)
CharsetInfo instance asociated with the
specified server charset.serverCharset - the server-specific character set nameCharsetInfopublic static CharsetInfo getCharsetForLCID(int lcid)
CharsetInfo instance asociated with the
specified LCID.lcid - the server LCIDCharsetInfopublic static CharsetInfo getCharsetForSortOrder(int sortOrder)
CharsetInfo instance asociated with the
specified sort order.sortOrder - the server sort orderCharsetInfopublic static CharsetInfo getCharset(byte[] collation) throws java.sql.SQLException
CharsetInfo instance asociated with the
specified collation.collation - the server LCIDCharsetInfojava.sql.SQLExceptionpublic java.lang.String getCharset()
public boolean isWideChars()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectGenerated on June 8 2013