Package net.sourceforge.jtds.jdbc
Class CharsetInfo
java.lang.Object
net.sourceforge.jtds.jdbc.CharsetInfo
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.
- Version:
- $Id: CharsetInfo.java,v 1.5 2007-07-08 17:28:23 bheineman Exp $
- Author:
- Alin Sinpalean
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe Java character set name.private static final HashMapServer charset to Java charset map.private static final StringName of theCharsets.propertiesresource.private static final HashMapLocale id to Java charset map.private static final CharsetInfo[]Sort order to Java charset map.private final booleanIndicates whether current charset is wide (ie multi-byte). -
Constructor Summary
ConstructorsConstructorDescriptionCharsetInfo(String descriptor) Constructs aCharsetInfoobject 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". -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieves the charset name.static CharsetInfogetCharset(byte[] collation) Retrieves theCharsetInfoinstance asociated with the specified collation.static CharsetInfogetCharset(String serverCharset) Retrieves theCharsetInfoinstance asociated with the specified server charset.static CharsetInfogetCharsetForLCID(int lcid) Retrieves theCharsetInfoinstance asociated with the specified LCID.static CharsetInfogetCharsetForSortOrder(int sortOrder) Retrieves theCharsetInfoinstance asociated with the specified sort order.inthashCode()booleanRetrieves whether the caracter set is wide (ie multi-byte).toString()
-
Field Details
-
CHARSETS_RESOURCE_NAME
Name of theCharsets.propertiesresource.- See Also:
-
charsets
Server charset to Java charset map. -
lcidToCharsetMap
Locale id to Java charset map. -
sortToCharsetMap
Sort order to Java charset map. -
charset
The Java character set name. -
wideChars
private final boolean wideCharsIndicates whether current charset is wide (ie multi-byte).
-
-
Constructor Details
-
CharsetInfo
Constructs aCharsetInfoobject 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".- Parameters:
descriptor- the charset descriptor
-
-
Method Details
-
getCharset
Retrieves theCharsetInfoinstance asociated with the specified server charset.- Parameters:
serverCharset- the server-specific character set name- Returns:
- the associated
CharsetInfo
-
getCharsetForLCID
Retrieves theCharsetInfoinstance asociated with the specified LCID.- Parameters:
lcid- the server LCID- Returns:
- the associated
CharsetInfo
-
getCharsetForSortOrder
Retrieves theCharsetInfoinstance asociated with the specified sort order.- Parameters:
sortOrder- the server sort order- Returns:
- the associated
CharsetInfo
-
getCharset
Retrieves theCharsetInfoinstance asociated with the specified collation.- Parameters:
collation- the server LCID- Returns:
- the associated
CharsetInfo - Throws:
SQLException
-
getCharset
Retrieves the charset name. -
isWideChars
public boolean isWideChars()Retrieves whether the caracter set is wide (ie multi-byte). -
equals
-
hashCode
public int hashCode() -
toString
-