Class CharacterSet
- java.lang.Object
-
- oracle.sql.CharacterSet
-
- Direct Known Subclasses:
CharacterSetWithConverter
public abstract class CharacterSet extends Object
This class encapsulates methods and attributes of the character sets defined by Oracle. It also defines a set of character set IDs that their character conversions are supported by Oracle JDBC.Most methods are of conversions between character representations.
There are no public constructors. To create a CharacterSet use oracle.sql.CharacterSetFactory. There is no notion of "unsupported" character set. CharacterSet's can be created with any oracleId. However, there is a notion of unsupported conversions and the current implementation is limited to the small number of character sets for which constants are defined in the class
There are two variants of an operation (e.g. convert vs. convertUnshared) the plain version is the fast (but possibly unsafe) one.
The descriptions of methods in this class use the phrase "bytes in oracleId representation". What this means is that the bytes can be interpreted as a sequence of characters in the character set defined by oracleId. Both what characters are available and how they are represented as sequences of bytes is determined by oracleId.
-
-
Field Summary
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static int
AL16UTF16BytesToJavaChars(byte[] bytes, int nbytes, char[] chars)
Convert a sequence of bytes in AL16UTF16 to an array of chars caller needs to allocate the chars arraystatic String
AL16UTF16BytesToString(byte[] bytes, int nbytes)
Convert a sequence of bytes in AL16UTF16 to a String this function will allocate a chars arraystatic char[]
AL32UTF8ToJavaChar(byte[] bytes, int offset, int count, boolean useReplacementCharacter)
Converts an AL32UTF8 byte array to an array of char.static String
AL32UTF8ToString(byte[] bytes, int offset, int nbytes)
Convert a sequence of bytes in AL32UTF8 format to a String.static String
AL32UTF8ToString(byte[] bytes, int offset, int nbytes, boolean useReplacementCharacter)
abstract byte[]
convert(String s)
Convert a String to bytes in oracleId representation.abstract byte[]
convert(CharacterSet from, byte[] source, int offset, int count)
Converts bytes in some representation to oracleId representation.static int
convertAL16UTF16BytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int count, boolean convertWithReplacement)
Converts a sequence of bytes in AL16UTF16 to an array of char's.static int
convertAL16UTF16LEBytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int count, boolean convertWithReplacement)
Converts a sequence of bytes in AL16UTF16LE to an array of char's.static int
convertAL32UTF8BytesToJavaChars(byte[] bytes, int offsetBytes, char[] chars, int offsetChars, int[] countArr, boolean convertWithReplacement)
Convert a sequence of bytes in AL32UTF8 to an array of char's.static int
convertAL32UTF8BytesToJavaChars(byte[] bytes, int offsetBytes, char[] chars, int offsetChars, int[] countArr, boolean convertWithReplacement, int charSize)
Same as convertAL32UTF8BytesToJavaChars(byte[],int,char[],int,int[],boolean) with an additional argument 'charSize' which is the number of chars available in the char array.static int
convertASCIIBytesToJavaChars(byte[] bytes, int bytes_offset, char[] chars, int chars_offset, int count)
convert a byte array in ascii to a Java char array.static int
convertJavaCharsToAL16UTF16Bytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars)
static int
convertJavaCharsToAL16UTF16LEBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars)
static int
convertJavaCharsToAL32UTF8Bytes(char[] chars, int chars_offset, byte[] bytes, int bytes_begin, int chars_count)
Convert char's to the UTF-8 representation.static int
convertJavaCharsToASCIIBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars)
convert a Java char array to a byte array in ascii.static int
convertJavaCharsToASCIIBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars, boolean strictConversion)
static int
convertJavaCharsToISOLATIN1Bytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars)
static int
convertJavaCharsToUTFBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_begin, int chars_count)
Convert char's to the UTF8 representation.byte[]
convertUnshared(CharacterSet from, byte[] source, int offset, int count)
Converts bytes in some representation to oracleId representation.static long
convertUTF32toUTF16(long ucs4ch)
static int
convertUTFBytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int[] countArr, boolean convertWithReplacement)
Convert a sequence of bytes in UTF8 to an array of char's.static int
convertUTFBytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int[] countArr, boolean convertWithReplacement, int charSize)
Convert a sequence of bytes in UTF8 to an array of char's.byte[]
convertWithReplacement(char[] chars, int charOffset, byte[] bytes, int byteOffset, int[] nchars)
Similar to convertWithReplacement(String s); Instead of a string, a char[] + offset with a length stored in nchars[0] will be converted.abstract byte[]
convertWithReplacement(String s)
Convert a String to bytes in oracleId representation.int
encodedByteLength(char[] carray)
Return the length of the byte array which would result if the char array were encoded in this character setint
encodedByteLength(String s)
Return the length of the byte array which would result if the String were encoded in this character setboolean
equals(Object rhs)
Two CharacterSet's are equal when their oracleId's are equalprotected oracle.jdbc.internal.OracleConnection
getConnectionDuringExceptionHandling()
int
getOracleId()
The integer that identifies the character set.int
hashCode()
Implements a hash based on oracleIdabstract boolean
isConvertibleFrom(CharacterSet source)
Are conversions supported.abstract boolean
isLossyFrom(CharacterSet from)
A conversion looses information if the mapping is not invertible.boolean
isUnicode()
Is this a Unicode Character Set.boolean
isUnknown()
static int
javaCharsToAL16UTF16Bytes(char[] chars, int nchars, byte[] bytes)
Convert a sequence of chars in UCS2 to an array of bytes caller needs to allocate the bytes arraystatic int
javaCharsToAL16UTF16LEBytes(char[] chars, int nchars, byte[] bytes)
Convert a sequence of chars in UCS2 to an array of bytes caller needs to allocate the bytes arraystatic CharacterSet
make(int oracleId)
Factory.static int
string32UTF8Length(String s)
Returns the number of bytes in the UTF-8 representation of a Stringstatic byte[]
stringToAL16UTF16Bytes(String str)
Convert a String to an array of bytes this function will allocate the bytes arraystatic byte[]
stringToAL16UTF16LEBytes(String str)
Convert a String to an array of bytes this function will allocate the bytes arraystatic byte[]
stringToAL32UTF8(String str)
static byte[]
stringToASCII(String str)
convert a String to a byte array in ascii.static byte[]
stringToUTF(String str)
Convert the str to a byte array that in UTF8 representation.static int
stringUTFLength(String s)
Returns the number of bytes in the UTF8 representation of a StringString
toString()
The official name of the character set.String
toString(byte[] bytes, int offset, int count)
Convert bytes in oracleId representation to a String.abstract String
toStringWithReplacement(byte[] bytes, int offset, int count)
Convert bytes in oracleId representation to a String.static char[]
UTFToJavaChar(byte[] bytes, int offset, int count)
Convert a sequence of bytes in UTF8 to an array of char's.static char[]
UTFToJavaChar(byte[] bytes, int offset, int count, boolean useReplacementChar)
Convert a sequence of bytes in UTF8 to an array of char's.static char[]
UTFToJavaCharWithReplacement(byte[] bytes, int offset, int count)
Convert a sequence of bytes in UTF8 to an array of char's.static String
UTFToString(byte[] bytes, int offset, int nbytes)
Convert a sequence of bytes in UTF8 to a String this function will to allocate the chars arraystatic String
UTFToString(byte[] bytes, int offset, int nbytes, boolean useReplacementChar)
Convert a sequence of bytes in UTF8 to a String this function will to allocate the chars array
-
-
-
Field Detail
-
DEFAULT_CHARSET
public static final short DEFAULT_CHARSET
Special value. What character set it returned depends on where this class running. When run in the server this is the database character set. When run in a client ...- See Also:
- Constant Field Values
-
ASCII_CHARSET
public static final short ASCII_CHARSET
- See Also:
- Constant Field Values
-
ISO_LATIN_1_CHARSET
public static final short ISO_LATIN_1_CHARSET
- See Also:
- Constant Field Values
-
UNICODE_1_CHARSET
public static final short UNICODE_1_CHARSET
- See Also:
- Constant Field Values
-
US7ASCII_CHARSET
public static final short US7ASCII_CHARSET
- See Also:
- Constant Field Values
-
WE8DEC_CHARSET
public static final short WE8DEC_CHARSET
- See Also:
- Constant Field Values
-
WE8HP_CHARSET
public static final short WE8HP_CHARSET
- See Also:
- Constant Field Values
-
US8PC437_CHARSET
public static final short US8PC437_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC37_CHARSET
public static final short WE8EBCDIC37_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC500_CHARSET
public static final short WE8EBCDIC500_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC285_CHARSET
public static final short WE8EBCDIC285_CHARSET
- See Also:
- Constant Field Values
-
WE8PC850_CHARSET
public static final short WE8PC850_CHARSET
- See Also:
- Constant Field Values
-
D7DEC_CHARSET
public static final short D7DEC_CHARSET
- See Also:
- Constant Field Values
-
F7DEC_CHARSET
public static final short F7DEC_CHARSET
- See Also:
- Constant Field Values
-
S7DEC_CHARSET
public static final short S7DEC_CHARSET
- See Also:
- Constant Field Values
-
E7DEC_CHARSET
public static final short E7DEC_CHARSET
- See Also:
- Constant Field Values
-
SF7ASCII_CHARSET
public static final short SF7ASCII_CHARSET
- See Also:
- Constant Field Values
-
NDK7DEC_CHARSET
public static final short NDK7DEC_CHARSET
- See Also:
- Constant Field Values
-
I7DEC_CHARSET
public static final short I7DEC_CHARSET
- See Also:
- Constant Field Values
-
NL7DEC_CHARSET
public static final short NL7DEC_CHARSET
- See Also:
- Constant Field Values
-
CH7DEC_CHARSET
public static final short CH7DEC_CHARSET
- See Also:
- Constant Field Values
-
YUG7ASCII_CHARSET
public static final short YUG7ASCII_CHARSET
- See Also:
- Constant Field Values
-
SF7DEC_CHARSET
public static final short SF7DEC_CHARSET
- See Also:
- Constant Field Values
-
TR7DEC_CHARSET
public static final short TR7DEC_CHARSET
- See Also:
- Constant Field Values
-
IW7IS960_CHARSET
public static final short IW7IS960_CHARSET
- See Also:
- Constant Field Values
-
IN8ISCII_CHARSET
public static final short IN8ISCII_CHARSET
- See Also:
- Constant Field Values
-
WE8ISO8859P1_CHARSET
public static final short WE8ISO8859P1_CHARSET
- See Also:
- Constant Field Values
-
EE8ISO8859P2_CHARSET
public static final short EE8ISO8859P2_CHARSET
- See Also:
- Constant Field Values
-
SE8ISO8859P3_CHARSET
public static final short SE8ISO8859P3_CHARSET
- See Also:
- Constant Field Values
-
NEE8ISO8859P4_CHARSET
public static final short NEE8ISO8859P4_CHARSET
- See Also:
- Constant Field Values
-
CL8ISO8859P5_CHARSET
public static final short CL8ISO8859P5_CHARSET
- See Also:
- Constant Field Values
-
AR8ISO8859P6_CHARSET
public static final short AR8ISO8859P6_CHARSET
- See Also:
- Constant Field Values
-
EL8ISO8859P7_CHARSET
public static final short EL8ISO8859P7_CHARSET
- See Also:
- Constant Field Values
-
IW8ISO8859P8_CHARSET
public static final short IW8ISO8859P8_CHARSET
- See Also:
- Constant Field Values
-
WE8ISO8859P9_CHARSET
public static final short WE8ISO8859P9_CHARSET
- See Also:
- Constant Field Values
-
NE8ISO8859P10_CHARSET
public static final short NE8ISO8859P10_CHARSET
- See Also:
- Constant Field Values
-
TH8TISASCII_CHARSET
public static final short TH8TISASCII_CHARSET
- See Also:
- Constant Field Values
-
TH8TISEBCDIC_CHARSET
public static final short TH8TISEBCDIC_CHARSET
- See Also:
- Constant Field Values
-
BN8BSCII_CHARSET
public static final short BN8BSCII_CHARSET
- See Also:
- Constant Field Values
-
VN8VN3_CHARSET
public static final short VN8VN3_CHARSET
- See Also:
- Constant Field Values
-
VN8MSWIN1258_CHARSET
public static final short VN8MSWIN1258_CHARSET
- See Also:
- Constant Field Values
-
WE8ISO8859P15_CHARSET
public static final short WE8ISO8859P15_CHARSET
- See Also:
- Constant Field Values
-
WE8NEXTSTEP_CHARSET
public static final short WE8NEXTSTEP_CHARSET
- See Also:
- Constant Field Values
-
AR8ASMO708PLUS_CHARSET
public static final short AR8ASMO708PLUS_CHARSET
- See Also:
- Constant Field Values
-
AR8EBCDICX_CHARSET
public static final short AR8EBCDICX_CHARSET
- See Also:
- Constant Field Values
-
AR8XBASIC_CHARSET
public static final short AR8XBASIC_CHARSET
- See Also:
- Constant Field Values
-
EL8DEC_CHARSET
public static final short EL8DEC_CHARSET
- See Also:
- Constant Field Values
-
TR8DEC_CHARSET
public static final short TR8DEC_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC37C_CHARSET
public static final short WE8EBCDIC37C_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC500C_CHARSET
public static final short WE8EBCDIC500C_CHARSET
- See Also:
- Constant Field Values
-
IW8EBCDIC424_CHARSET
public static final short IW8EBCDIC424_CHARSET
- See Also:
- Constant Field Values
-
TR8EBCDIC1026_CHARSET
public static final short TR8EBCDIC1026_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC871_CHARSET
public static final short WE8EBCDIC871_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC284_CHARSET
public static final short WE8EBCDIC284_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1047_CHARSET
public static final short WE8EBCDIC1047_CHARSET
- See Also:
- Constant Field Values
-
EEC8EUROASCI_CHARSET
public static final short EEC8EUROASCI_CHARSET
- See Also:
- Constant Field Values
-
EEC8EUROPA3_CHARSET
public static final short EEC8EUROPA3_CHARSET
- See Also:
- Constant Field Values
-
LA8PASSPORT_CHARSET
public static final short LA8PASSPORT_CHARSET
- See Also:
- Constant Field Values
-
BG8PC437S_CHARSET
public static final short BG8PC437S_CHARSET
- See Also:
- Constant Field Values
-
EE8PC852_CHARSET
public static final short EE8PC852_CHARSET
- See Also:
- Constant Field Values
-
RU8PC866_CHARSET
public static final short RU8PC866_CHARSET
- See Also:
- Constant Field Values
-
RU8BESTA_CHARSET
public static final short RU8BESTA_CHARSET
- See Also:
- Constant Field Values
-
IW8PC1507_CHARSET
public static final short IW8PC1507_CHARSET
- See Also:
- Constant Field Values
-
RU8PC855_CHARSET
public static final short RU8PC855_CHARSET
- See Also:
- Constant Field Values
-
TR8PC857_CHARSET
public static final short TR8PC857_CHARSET
- See Also:
- Constant Field Values
-
CL8MACCYRILLIC_CHARSET
public static final short CL8MACCYRILLIC_CHARSET
- See Also:
- Constant Field Values
-
CL8MACCYRILLICS_CHARSET
public static final short CL8MACCYRILLICS_CHARSET
- See Also:
- Constant Field Values
-
WE8PC860_CHARSET
public static final short WE8PC860_CHARSET
- See Also:
- Constant Field Values
-
IS8PC861_CHARSET
public static final short IS8PC861_CHARSET
- See Also:
- Constant Field Values
-
EE8MACCES_CHARSET
public static final short EE8MACCES_CHARSET
- See Also:
- Constant Field Values
-
EE8MACCROATIANS_CHARSET
public static final short EE8MACCROATIANS_CHARSET
- See Also:
- Constant Field Values
-
TR8MACTURKISHS_CHARSET
public static final short TR8MACTURKISHS_CHARSET
- See Also:
- Constant Field Values
-
IS8MACICELANDICS_CHARSET
public static final short IS8MACICELANDICS_CHARSET
- See Also:
- Constant Field Values
-
EL8MACGREEKS_CHARSET
public static final short EL8MACGREEKS_CHARSET
- See Also:
- Constant Field Values
-
IW8MACHEBREWS_CHARSET
public static final short IW8MACHEBREWS_CHARSET
- See Also:
- Constant Field Values
-
EE8MSWIN1250_CHARSET
public static final short EE8MSWIN1250_CHARSET
- See Also:
- Constant Field Values
-
CL8MSWIN1251_CHARSET
public static final short CL8MSWIN1251_CHARSET
- See Also:
- Constant Field Values
-
ET8MSWIN923_CHARSET
public static final short ET8MSWIN923_CHARSET
- See Also:
- Constant Field Values
-
BG8MSWIN_CHARSET
public static final short BG8MSWIN_CHARSET
- See Also:
- Constant Field Values
-
EL8MSWIN1253_CHARSET
public static final short EL8MSWIN1253_CHARSET
- See Also:
- Constant Field Values
-
IW8MSWIN1255_CHARSET
public static final short IW8MSWIN1255_CHARSET
- See Also:
- Constant Field Values
-
LT8MSWIN921_CHARSET
public static final short LT8MSWIN921_CHARSET
- See Also:
- Constant Field Values
-
TR8MSWIN1254_CHARSET
public static final short TR8MSWIN1254_CHARSET
- See Also:
- Constant Field Values
-
WE8MSWIN1252_CHARSET
public static final short WE8MSWIN1252_CHARSET
- See Also:
- Constant Field Values
-
BLT8MSWIN1257_CHARSET
public static final short BLT8MSWIN1257_CHARSET
- See Also:
- Constant Field Values
-
D8EBCDIC273_CHARSET
public static final short D8EBCDIC273_CHARSET
- See Also:
- Constant Field Values
-
I8EBCDIC280_CHARSET
public static final short I8EBCDIC280_CHARSET
- See Also:
- Constant Field Values
-
DK8EBCDIC277_CHARSET
public static final short DK8EBCDIC277_CHARSET
- See Also:
- Constant Field Values
-
S8EBCDIC278_CHARSET
public static final short S8EBCDIC278_CHARSET
- See Also:
- Constant Field Values
-
EE8EBCDIC870_CHARSET
public static final short EE8EBCDIC870_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1025_CHARSET
public static final short CL8EBCDIC1025_CHARSET
- See Also:
- Constant Field Values
-
F8EBCDIC297_CHARSET
public static final short F8EBCDIC297_CHARSET
- See Also:
- Constant Field Values
-
IW8EBCDIC1086_CHARSET
public static final short IW8EBCDIC1086_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1025X_CHARSET
public static final short CL8EBCDIC1025X_CHARSET
- See Also:
- Constant Field Values
-
N8PC865_CHARSET
public static final short N8PC865_CHARSET
- See Also:
- Constant Field Values
-
BLT8CP921_CHARSET
public static final short BLT8CP921_CHARSET
- See Also:
- Constant Field Values
-
LV8PC1117_CHARSET
public static final short LV8PC1117_CHARSET
- See Also:
- Constant Field Values
-
LV8PC8LR_CHARSET
public static final short LV8PC8LR_CHARSET
- See Also:
- Constant Field Values
-
BLT8EBCDIC1112_CHARSET
public static final short BLT8EBCDIC1112_CHARSET
- See Also:
- Constant Field Values
-
LV8RST104090_CHARSET
public static final short LV8RST104090_CHARSET
- See Also:
- Constant Field Values
-
CL8KOI8R_CHARSET
public static final short CL8KOI8R_CHARSET
- See Also:
- Constant Field Values
-
BLT8PC775_CHARSET
public static final short BLT8PC775_CHARSET
- See Also:
- Constant Field Values
-
F7SIEMENS9780X_CHARSET
public static final short F7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
E7SIEMENS9780X_CHARSET
public static final short E7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
S7SIEMENS9780X_CHARSET
public static final short S7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
DK7SIEMENS9780X_CHARSET
public static final short DK7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
N7SIEMENS9780X_CHARSET
public static final short N7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
I7SIEMENS9780X_CHARSET
public static final short I7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
D7SIEMENS9780X_CHARSET
public static final short D7SIEMENS9780X_CHARSET
- See Also:
- Constant Field Values
-
WE8GCOS7_CHARSET
public static final short WE8GCOS7_CHARSET
- See Also:
- Constant Field Values
-
EL8GCOS7_CHARSET
public static final short EL8GCOS7_CHARSET
- See Also:
- Constant Field Values
-
US8BS2000_CHARSET
public static final short US8BS2000_CHARSET
- See Also:
- Constant Field Values
-
D8BS2000_CHARSET
public static final short D8BS2000_CHARSET
- See Also:
- Constant Field Values
-
F8BS2000_CHARSET
public static final short F8BS2000_CHARSET
- See Also:
- Constant Field Values
-
E8BS2000_CHARSET
public static final short E8BS2000_CHARSET
- See Also:
- Constant Field Values
-
DK8BS2000_CHARSET
public static final short DK8BS2000_CHARSET
- See Also:
- Constant Field Values
-
S8BS2000_CHARSET
public static final short S8BS2000_CHARSET
- See Also:
- Constant Field Values
-
WE8BS2000_CHARSET
public static final short WE8BS2000_CHARSET
- See Also:
- Constant Field Values
-
CL8BS2000_CHARSET
public static final short CL8BS2000_CHARSET
- See Also:
- Constant Field Values
-
WE8BS2000L5_CHARSET
public static final short WE8BS2000L5_CHARSET
- See Also:
- Constant Field Values
-
WE8DG_CHARSET
public static final short WE8DG_CHARSET
- See Also:
- Constant Field Values
-
WE8NCR4970_CHARSET
public static final short WE8NCR4970_CHARSET
- See Also:
- Constant Field Values
-
WE8ROMAN8_CHARSET
public static final short WE8ROMAN8_CHARSET
- See Also:
- Constant Field Values
-
EE8MACCE_CHARSET
public static final short EE8MACCE_CHARSET
- See Also:
- Constant Field Values
-
EE8MACCROATIAN_CHARSET
public static final short EE8MACCROATIAN_CHARSET
- See Also:
- Constant Field Values
-
TR8MACTURKISH_CHARSET
public static final short TR8MACTURKISH_CHARSET
- See Also:
- Constant Field Values
-
IS8MACICELANDIC_CHARSET
public static final short IS8MACICELANDIC_CHARSET
- See Also:
- Constant Field Values
-
EL8MACGREEK_CHARSET
public static final short EL8MACGREEK_CHARSET
- See Also:
- Constant Field Values
-
IW8MACHEBREW_CHARSET
public static final short IW8MACHEBREW_CHARSET
- See Also:
- Constant Field Values
-
US8ICL_CHARSET
public static final short US8ICL_CHARSET
- See Also:
- Constant Field Values
-
WE8ICL_CHARSET
public static final short WE8ICL_CHARSET
- See Also:
- Constant Field Values
-
WE8ISOICLUK_CHARSET
public static final short WE8ISOICLUK_CHARSET
- See Also:
- Constant Field Values
-
WE8MACROMAN8_CHARSET
public static final short WE8MACROMAN8_CHARSET
- See Also:
- Constant Field Values
-
WE8MACROMAN8S_CHARSET
public static final short WE8MACROMAN8S_CHARSET
- See Also:
- Constant Field Values
-
TH8MACTHAI_CHARSET
public static final short TH8MACTHAI_CHARSET
- See Also:
- Constant Field Values
-
TH8MACTHAIS_CHARSET
public static final short TH8MACTHAIS_CHARSET
- See Also:
- Constant Field Values
-
HU8CWI2_CHARSET
public static final short HU8CWI2_CHARSET
- See Also:
- Constant Field Values
-
EL8PC437S_CHARSET
public static final short EL8PC437S_CHARSET
- See Also:
- Constant Field Values
-
EL8EBCDIC875_CHARSET
public static final short EL8EBCDIC875_CHARSET
- See Also:
- Constant Field Values
-
EL8PC737_CHARSET
public static final short EL8PC737_CHARSET
- See Also:
- Constant Field Values
-
LT8PC772_CHARSET
public static final short LT8PC772_CHARSET
- See Also:
- Constant Field Values
-
LT8PC774_CHARSET
public static final short LT8PC774_CHARSET
- See Also:
- Constant Field Values
-
EL8PC869_CHARSET
public static final short EL8PC869_CHARSET
- See Also:
- Constant Field Values
-
EL8PC851_CHARSET
public static final short EL8PC851_CHARSET
- See Also:
- Constant Field Values
-
CDN8PC863_CHARSET
public static final short CDN8PC863_CHARSET
- See Also:
- Constant Field Values
-
HU8ABMOD_CHARSET
public static final short HU8ABMOD_CHARSET
- See Also:
- Constant Field Values
-
AR8ASMO8X_CHARSET
public static final short AR8ASMO8X_CHARSET
- See Also:
- Constant Field Values
-
AR8NAFITHA711T_CHARSET
public static final short AR8NAFITHA711T_CHARSET
- See Also:
- Constant Field Values
-
AR8SAKHR707T_CHARSET
public static final short AR8SAKHR707T_CHARSET
- See Also:
- Constant Field Values
-
AR8MUSSAD768T_CHARSET
public static final short AR8MUSSAD768T_CHARSET
- See Also:
- Constant Field Values
-
AR8ADOS710T_CHARSET
public static final short AR8ADOS710T_CHARSET
- See Also:
- Constant Field Values
-
AR8ADOS720T_CHARSET
public static final short AR8ADOS720T_CHARSET
- See Also:
- Constant Field Values
-
AR8APTEC715T_CHARSET
public static final short AR8APTEC715T_CHARSET
- See Also:
- Constant Field Values
-
AR8NAFITHA721T_CHARSET
public static final short AR8NAFITHA721T_CHARSET
- See Also:
- Constant Field Values
-
AR8HPARABIC8T_CHARSET
public static final short AR8HPARABIC8T_CHARSET
- See Also:
- Constant Field Values
-
AR8NAFITHA711_CHARSET
public static final short AR8NAFITHA711_CHARSET
- See Also:
- Constant Field Values
-
AR8SAKHR707_CHARSET
public static final short AR8SAKHR707_CHARSET
- See Also:
- Constant Field Values
-
AR8MUSSAD768_CHARSET
public static final short AR8MUSSAD768_CHARSET
- See Also:
- Constant Field Values
-
AR8ADOS710_CHARSET
public static final short AR8ADOS710_CHARSET
- See Also:
- Constant Field Values
-
AR8ADOS720_CHARSET
public static final short AR8ADOS720_CHARSET
- See Also:
- Constant Field Values
-
AR8APTEC715_CHARSET
public static final short AR8APTEC715_CHARSET
- See Also:
- Constant Field Values
-
AR8MSAWIN_CHARSET
public static final short AR8MSAWIN_CHARSET
- See Also:
- Constant Field Values
-
AR8NAFITHA721_CHARSET
public static final short AR8NAFITHA721_CHARSET
- See Also:
- Constant Field Values
-
AR8SAKHR706_CHARSET
public static final short AR8SAKHR706_CHARSET
- See Also:
- Constant Field Values
-
AR8ARABICMAC_CHARSET
public static final short AR8ARABICMAC_CHARSET
- See Also:
- Constant Field Values
-
AR8ARABICMACS_CHARSET
public static final short AR8ARABICMACS_CHARSET
- See Also:
- Constant Field Values
-
AR8ARABICMACT_CHARSET
public static final short AR8ARABICMACT_CHARSET
- See Also:
- Constant Field Values
-
LA8ISO6937_CHARSET
public static final short LA8ISO6937_CHARSET
- See Also:
- Constant Field Values
-
US8NOOP_CHARSET
public static final short US8NOOP_CHARSET
- See Also:
- Constant Field Values
-
WE8DECTST_CHARSET
public static final short WE8DECTST_CHARSET
- See Also:
- Constant Field Values
-
JA16VMS_CHARSET
public static final short JA16VMS_CHARSET
- See Also:
- Constant Field Values
-
JA16EUC_CHARSET
public static final short JA16EUC_CHARSET
- See Also:
- Constant Field Values
-
JA16EUCYEN_CHARSET
public static final short JA16EUCYEN_CHARSET
- See Also:
- Constant Field Values
-
JA16SJIS_CHARSET
public static final short JA16SJIS_CHARSET
- See Also:
- Constant Field Values
-
JA16DBCS_CHARSET
public static final short JA16DBCS_CHARSET
- See Also:
- Constant Field Values
-
JA16SJISYEN_CHARSET
public static final short JA16SJISYEN_CHARSET
- See Also:
- Constant Field Values
-
JA16EBCDIC930_CHARSET
public static final short JA16EBCDIC930_CHARSET
- See Also:
- Constant Field Values
-
JA16MACSJIS_CHARSET
public static final short JA16MACSJIS_CHARSET
- See Also:
- Constant Field Values
-
JA16EUCTILDE_CHARSET
public static final short JA16EUCTILDE_CHARSET
- See Also:
- Constant Field Values
-
JA16SJISTILDE_CHARSET
public static final short JA16SJISTILDE_CHARSET
- See Also:
- Constant Field Values
-
KO16KSC5601_CHARSET
public static final short KO16KSC5601_CHARSET
- See Also:
- Constant Field Values
-
KO16DBCS_CHARSET
public static final short KO16DBCS_CHARSET
- See Also:
- Constant Field Values
-
KO16KSCCS_CHARSET
public static final short KO16KSCCS_CHARSET
- See Also:
- Constant Field Values
-
KO16MSWIN949_CHARSET
public static final short KO16MSWIN949_CHARSET
- See Also:
- Constant Field Values
-
ZHS16CGB231280_CHARSET
public static final short ZHS16CGB231280_CHARSET
- See Also:
- Constant Field Values
-
ZHS16MACCGB231280_CHARSET
public static final short ZHS16MACCGB231280_CHARSET
- See Also:
- Constant Field Values
-
ZHS16GBK_CHARSET
public static final short ZHS16GBK_CHARSET
- See Also:
- Constant Field Values
-
ZHS16DBCS_CHARSET
public static final short ZHS16DBCS_CHARSET
- See Also:
- Constant Field Values
-
ZHS32GB18030_CHARSET
public static final short ZHS32GB18030_CHARSET
- See Also:
- Constant Field Values
-
ZHT32EUC_CHARSET
public static final short ZHT32EUC_CHARSET
- See Also:
- Constant Field Values
-
ZHT32SOPS_CHARSET
public static final short ZHT32SOPS_CHARSET
- See Also:
- Constant Field Values
-
ZHT16DBT_CHARSET
public static final short ZHT16DBT_CHARSET
- See Also:
- Constant Field Values
-
ZHT32TRIS_CHARSET
public static final short ZHT32TRIS_CHARSET
- See Also:
- Constant Field Values
-
ZHT16DBCS_CHARSET
public static final short ZHT16DBCS_CHARSET
- See Also:
- Constant Field Values
-
ZHT16BIG5_CHARSET
public static final short ZHT16BIG5_CHARSET
- See Also:
- Constant Field Values
-
ZHT16CCDC_CHARSET
public static final short ZHT16CCDC_CHARSET
- See Also:
- Constant Field Values
-
ZHT16MSWIN950_CHARSET
public static final short ZHT16MSWIN950_CHARSET
- See Also:
- Constant Field Values
-
AL24UTFFSS_CHARSET
public static final short AL24UTFFSS_CHARSET
- See Also:
- Constant Field Values
-
UTF8_CHARSET
public static final short UTF8_CHARSET
- See Also:
- Constant Field Values
-
UTFE_CHARSET
public static final short UTFE_CHARSET
- See Also:
- Constant Field Values
-
AL32UTF8_CHARSET
public static final short AL32UTF8_CHARSET
- See Also:
- Constant Field Values
-
KO16TSTSET_CHARSET
public static final short KO16TSTSET_CHARSET
- See Also:
- Constant Field Values
-
JA16TSTSET2_CHARSET
public static final short JA16TSTSET2_CHARSET
- See Also:
- Constant Field Values
-
JA16TSTSET_CHARSET
public static final short JA16TSTSET_CHARSET
- See Also:
- Constant Field Values
-
US16TSTFIXED_CHARSET
public static final short US16TSTFIXED_CHARSET
- See Also:
- Constant Field Values
-
AL16UTF16_CHARSET
public static final short AL16UTF16_CHARSET
- See Also:
- Constant Field Values
-
AL16UTF16LE_CHARSET
public static final short AL16UTF16LE_CHARSET
- See Also:
- Constant Field Values
-
TH8TISEBCDICS_CHARSET
public static final short TH8TISEBCDICS_CHARSET
- See Also:
- Constant Field Values
-
BLT8EBCDIC1112S_CHARSET
public static final short BLT8EBCDIC1112S_CHARSET
- See Also:
- Constant Field Values
-
CE8BS2000_CHARSET
public static final short CE8BS2000_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1025R_CHARSET
public static final short CL8EBCDIC1025R_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1158R_CHARSET
public static final short CL8EBCDIC1158R_CHARSET
- See Also:
- Constant Field Values
-
D8EBCDIC1141_CHARSET
public static final short D8EBCDIC1141_CHARSET
- See Also:
- Constant Field Values
-
DK8EBCDIC1142_CHARSET
public static final short DK8EBCDIC1142_CHARSET
- See Also:
- Constant Field Values
-
EE8BS2000_CHARSET
public static final short EE8BS2000_CHARSET
- See Also:
- Constant Field Values
-
EE8EBCDIC870S_CHARSET
public static final short EE8EBCDIC870S_CHARSET
- See Also:
- Constant Field Values
-
EL8EBCDIC423R_CHARSET
public static final short EL8EBCDIC423R_CHARSET
- See Also:
- Constant Field Values
-
EL8EBCDIC875S_CHARSET
public static final short EL8EBCDIC875S_CHARSET
- See Also:
- Constant Field Values
-
EL8EBCDIC875R_CHARSET
public static final short EL8EBCDIC875R_CHARSET
- See Also:
- Constant Field Values
-
F8EBCDIC1147_CHARSET
public static final short F8EBCDIC1147_CHARSET
- See Also:
- Constant Field Values
-
I8EBCDIC1144_CHARSET
public static final short I8EBCDIC1144_CHARSET
- See Also:
- Constant Field Values
-
WE8BS2000E_CHARSET
public static final short WE8BS2000E_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1047E_CHARSET
public static final short WE8EBCDIC1047E_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1140_CHARSET
public static final short WE8EBCDIC1140_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1145_CHARSET
public static final short WE8EBCDIC1145_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1146_CHARSET
public static final short WE8EBCDIC1146_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1148_CHARSET
public static final short WE8EBCDIC1148_CHARSET
- See Also:
- Constant Field Values
-
AR8EBCDIC420S_CHARSET
public static final short AR8EBCDIC420S_CHARSET
- See Also:
- Constant Field Values
-
IW8EBCDIC424S_CHARSET
public static final short IW8EBCDIC424S_CHARSET
- See Also:
- Constant Field Values
-
TR8EBCDIC1026S_CHARSET
public static final short TR8EBCDIC1026S_CHARSET
- See Also:
- Constant Field Values
-
ZHT16HKSCS_CHARSET
public static final short ZHT16HKSCS_CHARSET
- See Also:
- Constant Field Values
-
BLT8ISO8859P13_CHARSET
public static final short BLT8ISO8859P13_CHARSET
- See Also:
- Constant Field Values
-
AR8MSWIN1256_CHARSET
public static final short AR8MSWIN1256_CHARSET
- See Also:
- Constant Field Values
-
S8EBCDIC1143_CHARSET
public static final short S8EBCDIC1143_CHARSET
- See Also:
- Constant Field Values
-
ZHT16HKSCS31_CHARSET
public static final short ZHT16HKSCS31_CHARSET
- See Also:
- Constant Field Values
-
AZ8ISO8859P9E_CHARSET
public static final short AZ8ISO8859P9E_CHARSET
- See Also:
- Constant Field Values
-
CEL8ISO8859P14_CHARSET
public static final short CEL8ISO8859P14_CHARSET
- See Also:
- Constant Field Values
-
CL8ISOIR111_CHARSET
public static final short CL8ISOIR111_CHARSET
- See Also:
- Constant Field Values
-
CL8KOI8U_CHARSET
public static final short CL8KOI8U_CHARSET
- See Also:
- Constant Field Values
-
WE8PC858_CHARSET
public static final short WE8PC858_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1025C_CHARSET
public static final short CL8EBCDIC1025C_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1025S_CHARSET
public static final short CL8EBCDIC1025S_CHARSET
- See Also:
- Constant Field Values
-
CL8EBCDIC1158_CHARSET
public static final short CL8EBCDIC1158_CHARSET
- See Also:
- Constant Field Values
-
EE8EBCDIC870C_CHARSET
public static final short EE8EBCDIC870C_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC924_CHARSET
public static final short WE8EBCDIC924_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1140C_CHARSET
public static final short WE8EBCDIC1140C_CHARSET
- See Also:
- Constant Field Values
-
WE8EBCDIC1148C_CHARSET
public static final short WE8EBCDIC1148C_CHARSET
- See Also:
- Constant Field Values
-
UNICODE_2_CHARSET
public static final short UNICODE_2_CHARSET
This unicode is a "true UTF8". That means null bytes can appear (unlike Java UTF8 where null bytes are always represented by two non-null bytes- See Also:
- Constant Field Values
-
-
Method Detail
-
make
public static CharacterSet make(int oracleId)
Factory. A factory is used rather than a constructor because CharacterSet is abstract.- Parameters:
oracleId
- the number of the Oracle character set. A list of official Oracle character sets is maintained by ...- Returns:
- CharacterSet for oracleId.
-
toString
public String toString()
The official name of the character set.
-
isLossyFrom
public abstract boolean isLossyFrom(CharacterSet from)
A conversion looses information if the mapping is not invertible. (A mathematicial would say that the map of characters in from to this is not injective.)- Parameters:
from
- a CharacterSet being tested for compatibility with this CharacterSet.- Returns:
- true if characters in the from character set can be mapped uniquely to characters in oracleId representation.
-
isConvertibleFrom
public abstract boolean isConvertibleFrom(CharacterSet source)
Are conversions supported.- Parameters:
source
- a CharacterSet to inquire about- Returns:
- true if conversion from source to oracleId is supported. If it isn't supported attempts to convert will always throw exceptions.
-
isUnicode
public boolean isUnicode()
Is this a Unicode Character Set.- Returns:
- true if this CharacterSet is an encoding of Unicode
-
getOracleId
public int getOracleId()
The integer that identifies the character set.- Returns:
- Oracle character set ID
-
equals
public boolean equals(Object rhs)
Two CharacterSet's are equal when their oracleId's are equal
-
hashCode
public int hashCode()
Implements a hash based on oracleId
-
toStringWithReplacement
public abstract String toStringWithReplacement(byte[] bytes, int offset, int count)
Convert bytes in oracleId representation to a String. If a character has no Unicode representation the effect is unspecified. The conversion might omit it, or replace it with a special character. The preferred result is replacement by a single character, but it is not guaranteed. If the conversion isn't supported at all, the result may be a fixed string.- Parameters:
bytes
- a array containing characters represented in this character set.offset
- the index of the first byte or the charcterscount
- the number of bytes to be converted.- Returns:
- the String resulting from converting to UCS-2.
-
toString
public String toString(byte[] bytes, int offset, int count) throws SQLException
Convert bytes in oracleId representation to a String. The difference between toStringInvertible and plain toString is that toStringInvertible will throw an exception when toString would make some replacement.- Parameters:
bytes
- a array containing characters represented in this character set.offset
- the index of the first byte or the charcterscount
- the number of bytes to be converted.- Returns:
- the String resulting from converting to UCS-2.
- Throws:
SQLException
- when conversion is not supported.
-
convert
public abstract byte[] convert(String s) throws SQLException
Convert a String to bytes in oracleId representation.- Returns:
- an array containing the sequence of bytes in oracleId representation that represent the sequence of Unicode characters in String.
- Throws:
SQLException
- when the oracleId does not support conversion from Unicode.SQLException
- when s contains a character that cannot be converted.
-
convertWithReplacement
public abstract byte[] convertWithReplacement(String s)
Convert a String to bytes in oracleId representation. A String is always produced even when the conversion isn't supported or it contains characters that do not have a representation in oracleId. The usual conversion is to replace characters that don't have a representation with some fixed character, but that is not guranteed.- Returns:
- an array containing the sequence of bytes in oracleId representation that represent the sequence of Unicode characters in String.
-
convertWithReplacement
public byte[] convertWithReplacement(char[] chars, int charOffset, byte[] bytes, int byteOffset, int[] nchars)
Similar to convertWithReplacement(String s); Instead of a string, a char[] + offset with a length stored in nchars[0] will be converted.- Returns:
- an array containing the sequence of bytes in oracleId representation that represent the sequence of Unicode characters in the char[]. nchars[0] has the bytes length.
-
convert
public abstract byte[] convert(CharacterSet from, byte[] source, int offset, int count) throws SQLException
Converts bytes in some representation to oracleId representation. Note that the input is not guaranteed to be different from the output. If a copy is always wanted then use convertUnshared.- Parameters:
from
- the character set of the input bytessource
- an array of bytes containing the bytes to be convertedoffset
- the index of the first byte to be convertedcount
- the number of bytes to be converted- Returns:
- a byte array in the Oracle character set
- Throws:
SQLException
- if the conversion is not supportedSQLException
- if some character cannot be converted. This exception is not guaranteed to be thrown. For some conversions a replacement character may be used instead.
-
convertUnshared
public byte[] convertUnshared(CharacterSet from, byte[] source, int offset, int count) throws SQLException
Converts bytes in some representation to oracleId representation. This is identical to convert except that it always returns a copy of it's input.- Parameters:
from
- the character set of the input bytessource
- an array of bytes containing the bytes to be convertedoffset
- the index of the first byte to be convertedcount
- the number of bytes to be converted- Returns:
- an array containing a representation as an oracleId of characters in the source.
- Throws:
SQLException
- if the conversion is not supported.
-
UTFToString
public static final String UTFToString(byte[] bytes, int offset, int nbytes, boolean useReplacementChar) throws SQLException
Convert a sequence of bytes in UTF8 to a String this function will to allocate the chars array- Parameters:
bytes
- containing the UTF8 stringnbytes
- of bytesuseReplacementChar
- if true invalid characters are replaced by replacement characters.- Returns:
- the number of char wrote to the chars array
- Throws:
SQLException
-
UTFToString
public static final String UTFToString(byte[] bytes, int offset, int nbytes) throws SQLException
Convert a sequence of bytes in UTF8 to a String this function will to allocate the chars array- Parameters:
bytes
- containing the UTF8 stringnbytes
- of bytes- Returns:
- the number of char wrote to the chars array
- Throws:
SQLException
-
UTFToJavaChar
public static final char[] UTFToJavaChar(byte[] bytes, int offset, int count) throws SQLException
Convert a sequence of bytes in UTF8 to an array of char's. This is different from the offical UTF-8 in that this does not support surrogate characters. To support surrogate, use AL32UTF8 The primary use of this code is to create a string. Note that this method is "true" UTF8. That is in the input, null's may appear encoding themselves.- Parameters:
bytes
- the array holding the UTF8 bytesoffset
- the index of the first bytecount
- the number of bytes in the UFT8 sequence.- Returns:
- an array of char's equivalent to the UTF8 sequence.
- Throws:
SQLException
- if any error occurs
-
UTFToJavaChar
public static final char[] UTFToJavaChar(byte[] bytes, int offset, int count, boolean useReplacementChar) throws SQLException
Convert a sequence of bytes in UTF8 to an array of char's. This is different from the offical UTF-8 in that this does not support surrogate characters. To support surrogate, use AL32UTF8 The primary use of this code is to create a string. Note that this method is "true" UTF8. That is in the input, null's may appear encoding themselves.- Parameters:
bytes
- the array holding the UTF8 bytesoffset
- the index of the first bytecount
- the number of bytes in the UFT8 sequence.useReplacementChar
- if true invalid characters are replaced by replacement characters.- Returns:
- an array of char's equivalent to the UTF8 sequence.
- Throws:
SQLException
- if any error occurs
-
UTFToJavaCharWithReplacement
public static final char[] UTFToJavaCharWithReplacement(byte[] bytes, int offset, int count)
Convert a sequence of bytes in UTF8 to an array of char's. This is different from the offical UTF-8 in that this does not support surrogate characters. To support surrogate, use AL32UTF8 The primary use of this code is to create a string. Note that this method is "true" UTF8. That is in the input, null's may appear encoding themselves.- Parameters:
bytes
- the array holding the UTF8 bytesoffset
- the index of the first bytecount
- the number of bytes in the UFT8 sequence.- Returns:
- an array of char's equivalent to the UTF8 sequence.
- Throws:
IllegalStateException
- if any error occurs
-
convertUTFBytesToJavaChars
public static final int convertUTFBytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int[] countArr, boolean convertWithReplacement) throws SQLException
Convert a sequence of bytes in UTF8 to an array of char's. This is different from the offical UTF-8 in that the maximum length of a character is 3 bytes. So a surrogate pair will be represented as 6 bytes (2 times 3 bytes). To support surrogate pairs as 4 bytes, use AL32UTF8. Note that this method is "true" UTF8. That is in the input, null's may appear encoding themselves.- Parameters:
bytes
- the array holding the UTF8 bytesoffset
- the index of the first bytechars
- the array of holding the UTF-16 char arraychars_offset
- the idnex of the first char that will be writtencountArr
- IN/OUT parameter. countArr[0](IN) contains the number of bytes in the UTF8 sequence that need to be converted.convertWithReplacement
- set to true to use replacement character for illegal sequences- Returns:
- the number of chars written. countArr[0](OUT) contains the number of bytes in the bytes[] array that have been ignored because the rest of the sequence is missing (can be up to 3) or because the char[] was too short (can be more that 3).
- Throws:
SQLException
- if invalid, illegal UTF data is given
-
convertUTFBytesToJavaChars
public static final int convertUTFBytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int[] countArr, boolean convertWithReplacement, int charSize) throws SQLException
Convert a sequence of bytes in UTF8 to an array of char's. This is different from the offical UTF-8 in that the maximum length of a character is 3 bytes. So a surrogate pair will be represented as 6 bytes (2 times 3 bytes). To support surrogate pairs as 4 bytes, use AL32UTF8. Note that this method is "true" UTF8. That is in the input, null's may appear encoding themselves. Same as convertUTFBytesToJavaChars(byte[],int,char[],int,int[],boolean) with an additional argument 'charSize' which is the number of chars available in the char array. Note that if chars_offset+charSize>char.length, then an IndexArrayOutOfBound exception will be thrown. This method has been optimized for speed: 1) 'switch -case' has been replaced with a series of logical shifts and zero comparisons; 2) the internal loop with attempt to optimize array bounds checks away has been added.- Parameters:
bytes
- the array holding the UTF8 bytesoffset
- the index of the first bytechars
- the array of holding the UTF-16 char arraychars_offset
- the idnex of the first char that will be writtencountArr
- IN/OUT parameter. countArr[0](IN) contains the number of bytes in the UTF8 sequence that need to be converted.convertWithReplacement
- set to true to use replacement character for illegal sequences- Returns:
- the number of chars written. countArr[0](OUT) contains the number of bytes in the bytes[] array that have been ignored because the rest of the sequence is missing (can be up to 3) or because the char[] was too short (can be more that 3).
- Throws:
SQLException
- if invalid, illegal UTF data is given
-
stringToUTF
public static final byte[] stringToUTF(String str)
Convert the str to a byte array that in UTF8 representation.
-
convertJavaCharsToUTFBytes
public static final int convertJavaCharsToUTFBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_begin, int chars_count)
Convert char's to the UTF8 representation.No validation is performed.
- Parameters:
chars
- a source string in an array of charschars_offset
- an offset to start copying in the source stringchars_count
- a length to copy from the source stringbytes
- a destination byte arraybytes_begin
- an offset to start copying in the destination byte array- Returns:
- the length copy operation was performed
-
stringUTFLength
public static final int stringUTFLength(String s)
Returns the number of bytes in the UTF8 representation of a String- Parameters:
s
- a Java string- Returns:
- The number of bytes in the UTF8 encoding
-
AL32UTF8ToString
public static final String AL32UTF8ToString(byte[] bytes, int offset, int nbytes)
Convert a sequence of bytes in AL32UTF8 format to a String. this function will allocate the memory for holding the returning String.- Parameters:
bytes
- containing the AL32UTF8 stringoffset
- an offset to start conversionnbytes
- of bytes- Returns:
- the converted String
-
AL32UTF8ToString
public static final String AL32UTF8ToString(byte[] bytes, int offset, int nbytes, boolean useReplacementCharacter)
-
AL32UTF8ToJavaChar
public static final char[] AL32UTF8ToJavaChar(byte[] bytes, int offset, int count, boolean useReplacementCharacter) throws SQLException
Converts an AL32UTF8 byte array to an array of char. This function will allocate a char array for holding the returning result.- Parameters:
bytes
- an AL32UTF8 byte arrayoffset
- an offset to start conversioncount
- number of bytes to be converted.- Returns:
- an array of char data
- Throws:
SQLException
-
convertAL32UTF8BytesToJavaChars
public static final int convertAL32UTF8BytesToJavaChars(byte[] bytes, int offsetBytes, char[] chars, int offsetChars, int[] countArr, boolean convertWithReplacement) throws SQLException
Convert a sequence of bytes in AL32UTF8 to an array of char's. A char in AL32UTF8 can be represented with up to 4 bytes. The only difference between UTF8 (Oracle's) and AL32UTF8 is the representation of a surrogate pair. In AL32UTF8 a surrogate pair is represented with 4 bytes instead of 6 bytes in UTF8.- Parameters:
bytes
- the array holding the AL32UTF8 bytesoffsetBytes
- the index of the first bytechars
- the array of holding the UTF-16 char arrayoffsetChars
- the index of the first char that will be writtencountArr
- IN/OUT parameter. countArr[0](IN) contains the number of bytes in the UTF8 sequence that need to be converted.convertWithReplacement
- set to true to use replacement character for illegal sequences- Returns:
- the number of chars written. countArr[0](OUT) contains the number of bytes in the bytes[] array that have been ignored because the rest of the sequence is missing (can be up to 4) or because the char[] was too short (can be more than 4).
- Throws:
SQLException
- if invalid, illegal UTF data is given
-
convertAL32UTF8BytesToJavaChars
public static final int convertAL32UTF8BytesToJavaChars(byte[] bytes, int offsetBytes, char[] chars, int offsetChars, int[] countArr, boolean convertWithReplacement, int charSize) throws SQLException
Same as convertAL32UTF8BytesToJavaChars(byte[],int,char[],int,int[],boolean) with an additional argument 'charSize' which is the number of chars available in the char array. Note that if chars_offset+charSize>char.length, then an IndexArrayOutOfBound exception will be thrown. This method has been optimized for speed: 1) 'switch -case' has been replaced with a series of logical shifts and zero comparisons; 2) the internal loop with attempt to optimize array bounds checks away has been added.- Throws:
SQLException
-
stringToAL32UTF8
public static final byte[] stringToAL32UTF8(String str)
-
convertJavaCharsToAL32UTF8Bytes
public static final int convertJavaCharsToAL32UTF8Bytes(char[] chars, int chars_offset, byte[] bytes, int bytes_begin, int chars_count)
Convert char's to the UTF-8 representation.No validation is performed except surrogate pairs
- Parameters:
chars
- a source string in an array of charschars_offset
- an offset to start copying in the source stringbytes
- a destination byte arraybytes_begin
- an offset to start copying in the destination byte arraychars_count
- a length to copy from the source string- Returns:
- the length copy operation was performed
-
string32UTF8Length
public static final int string32UTF8Length(String s)
Returns the number of bytes in the UTF-8 representation of a StringThis method doesn't check neither invalid- nor illegal-UTF sequence.
- Parameters:
s
- a UTF-16 string to count the number of bytes in UTF8 format- Returns:
- The number of bytes in the UTF-8 representaion of a string
-
AL16UTF16BytesToString
public static final String AL16UTF16BytesToString(byte[] bytes, int nbytes)
Convert a sequence of bytes in AL16UTF16 to a String this function will allocate a chars array- Parameters:
bytes
- containing the AL16UTF16 stringnbytes
- of bytes- Returns:
- a newly generated String
-
AL16UTF16BytesToJavaChars
public static final int AL16UTF16BytesToJavaChars(byte[] bytes, int nbytes, char[] chars)
Convert a sequence of bytes in AL16UTF16 to an array of chars caller needs to allocate the chars array- Parameters:
bytes
- containing the AL16UTF16 stringnbytes
- of byteschars
- char array which the UCS2 string will be returned in- Returns:
- the number of char wrote to the chars array
-
convertAL16UTF16BytesToJavaChars
public static final int convertAL16UTF16BytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int count, boolean convertWithReplacement) throws SQLException
Converts a sequence of bytes in AL16UTF16 to an array of char's.- Parameters:
bytes
- the array holding the AL16UTF16 bytesoffset
- the index of the first bytechars
- the array of holding the UTF-16 char arraychars_offset
- the index of the first charcount
- the number of bytes in the AL16UTF16 sequence.convertWithReplacement
- set to true to use replacement character for illegal- Returns:
- the number of chars written
- Throws:
SQLException
- if invalid, illegal UTF data is given
-
convertAL16UTF16LEBytesToJavaChars
public static final int convertAL16UTF16LEBytesToJavaChars(byte[] bytes, int offset, char[] chars, int chars_offset, int count, boolean convertWithReplacement) throws SQLException
Converts a sequence of bytes in AL16UTF16LE to an array of char's.- Parameters:
bytes
- the array holding the AL16UTF16LE bytesoffset
- the index of the first bytechars
- the array of holding the UTF16UTF16LE char arraychars_offset
- the index of the first charcount
- the number of bytes in the AL16UTF16LE sequence.convertWithReplacement
- set to true to use replacement character for illegal- Returns:
- an array of char's equivalent to the AL16UTF16LE sequence.
- Throws:
SQLException
- if invalid, illegal UTF data is given
-
stringToAL16UTF16Bytes
public static final byte[] stringToAL16UTF16Bytes(String str)
Convert a String to an array of bytes this function will allocate the bytes array- Parameters:
str
- containing the UCS2 string- Returns:
- the AL16UTF16 byte array
-
javaCharsToAL16UTF16Bytes
public static final int javaCharsToAL16UTF16Bytes(char[] chars, int nchars, byte[] bytes)
Convert a sequence of chars in UCS2 to an array of bytes caller needs to allocate the bytes array- Parameters:
chars
- containing the UCS2 stringnchars
- of charsbytes
- byte array which the AL16UTF16 string will be returned in- Returns:
- the number of bytes wrote to the bytes array
-
convertJavaCharsToAL16UTF16Bytes
public static final int convertJavaCharsToAL16UTF16Bytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars)
-
stringToAL16UTF16LEBytes
public static final byte[] stringToAL16UTF16LEBytes(String str)
Convert a String to an array of bytes this function will allocate the bytes array- Parameters:
str
- containing the UCS2 string- Returns:
- the AL16UTF16LE byte array
-
javaCharsToAL16UTF16LEBytes
public static final int javaCharsToAL16UTF16LEBytes(char[] chars, int nchars, byte[] bytes)
Convert a sequence of chars in UCS2 to an array of bytes caller needs to allocate the bytes array- Parameters:
chars
- containing the UCS2 stringnchars
- of charsbytes
- byte array which the AL16UTF16LE string will be returned in- Returns:
- the number of bytes wrote to the bytes array
-
convertJavaCharsToAL16UTF16LEBytes
public static final int convertJavaCharsToAL16UTF16LEBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars)
-
convertASCIIBytesToJavaChars
public static final int convertASCIIBytesToJavaChars(byte[] bytes, int bytes_offset, char[] chars, int chars_offset, int count) throws SQLException
convert a byte array in ascii to a Java char array. The caller needs to allocate the buffer of chars.- Parameters:
bytes
- input bytesbytes_offset
- the starting position to convertchars
- output Java char array (buffer is allocated by the caller)chars_offset
- starting position to store the Java char arraycount
- number of characters in chars- Returns:
- the number of Java character written into chars[]
- Throws:
SQLException
- if errors occurred
-
convertJavaCharsToASCIIBytes
public static final int convertJavaCharsToASCIIBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars) throws SQLException
convert a Java char array to a byte array in ascii. The caller needs to allocate the buffer of bytes.- Parameters:
chars
- input Java char arraychars_offset
- input the starting position to convertbytes
- output the converted byte array in asciibytes_offset
- input the starting position to hold the returning bytes- Returns:
- the number of chars converted
- Throws:
SQLException
- if errors occurred
-
convertJavaCharsToASCIIBytes
public static final int convertJavaCharsToASCIIBytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars, boolean strictConversion) throws SQLException
- Throws:
SQLException
-
convertJavaCharsToISOLATIN1Bytes
public static final int convertJavaCharsToISOLATIN1Bytes(char[] chars, int chars_offset, byte[] bytes, int bytes_offset, int nchars) throws SQLException
- Throws:
SQLException
-
stringToASCII
public static final byte[] stringToASCII(String str)
convert a String to a byte array in ascii. This method will allocate the byte array.- Parameters:
str
- input the String to be converted- Returns:
- the byte array in ascii
-
convertUTF32toUTF16
public static final long convertUTF32toUTF16(long ucs4ch)
-
encodedByteLength
public int encodedByteLength(String s) throws SQLException
Return the length of the byte array which would result if the String were encoded in this character set- Parameters:
s
- is a Java String- Returns:
- the length of the encoded bytes
- Throws:
SQLException
-
encodedByteLength
public int encodedByteLength(char[] carray)
Return the length of the byte array which would result if the char array were encoded in this character set- Parameters:
carray
- is a char array- Returns:
- the length of the encoded bytes
-
getConnectionDuringExceptionHandling
protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
-
isUnknown
public boolean isUnknown()
-
-