net.sourceforge.jtds.jdbc
Class CharsetInfo
java.lang.Object
net.sourceforge.jtds.jdbc.CharsetInfo
public final class CharsetInfo
extends java.lang.Object
Loads and stores information about character sets. Static fields and methods
are concerned with loading, storing and retrieval of all character set
information, while non-static fields and methods describe a particular
character set (Java charset name and whether it's a multi-byte charset).
Note: Only one
CharsetInfo
instance exists per charset.
This allows simple equality comparisons between instances retrieved with any
of the
get
methods.
$Id: CharsetInfo.java,v 1.5 2007/07/08 17:28:23 bheineman Exp $
CharsetInfo(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".
|
CHARSETS_RESOURCE_NAME
private static final String CHARSETS_RESOURCE_NAME
Name of the Charsets.properties
resource.
charset
private final String charset
The Java character set name.
charsets
private static final HashMap charsets
Server charset to Java charset map.
lcidToCharsetMap
private static final HashMap lcidToCharsetMap
Locale id to Java charset map.
sortToCharsetMap
private static final CharsetInfo[] sortToCharsetMap
Sort order to Java charset map.
wideChars
private final boolean wideChars
Indicates whether current charset is wide (ie multi-byte).
CharsetInfo
public CharsetInfo(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".
descriptor
- the charset descriptor
equals
public boolean equals(Object o)
getCharset
public String getCharset()
Retrieves the charset name.
getCharset
public static CharsetInfo getCharset(String serverCharset)
Retrieves the CharsetInfo
instance asociated with the
specified server charset.
serverCharset
- the server-specific character set name
- the associated
CharsetInfo
getCharset
public static CharsetInfo getCharset(byte[] collation)
throws SQLException
Retrieves the CharsetInfo
instance asociated with the
specified collation.
collation
- the server LCID
- the associated
CharsetInfo
getCharsetForLCID
public static CharsetInfo getCharsetForLCID(int lcid)
Retrieves the CharsetInfo
instance asociated with the
specified LCID.
- the associated
CharsetInfo
getCharsetForSortOrder
public static CharsetInfo getCharsetForSortOrder(int sortOrder)
Retrieves the CharsetInfo
instance asociated with the
specified sort order.
sortOrder
- the server sort order
- the associated
CharsetInfo
hashCode
public int hashCode()
isWideChars
public boolean isWideChars()
Retrieves whether the caracter set is wide (ie multi-byte).
toString
public String toString()
Generated on September 18 2009