com.ibm.mq.headers
Class CCSID
- java.lang.Object
-
- com.ibm.mq.headers.CCSID
-
- Direct Known Subclasses:
- CCSID
public class CCSID extends java.lang.ObjectUtility class for converting between numeric CCSID values defined by IBM MQ; codepage names known by the operating system and used by Java for character conversion; charsets used by Java for character conversion.This is basically now a wrapper for JmqiCodepage...
Note: Since all Java strings are Unicode, it is never possible to have a string in an alien codepage. The interactions supported by this class are always conversions between Java strings and byte arrays, which can contain data representing strings in any codepage.
Note: All operations are provided by static methods. No instance of CCSID can be created.
-
-
Constructor Summary
Constructors Constructor and Description CCSID()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description static java.lang.Stringconvert(byte[] bytes, int ccsid)Deprecated.preferCharsets.convert(byte[],int)static java.lang.Stringconvert(byte[] bytes, int offset, int length, int ccsid)Deprecated.static byte[]convert(java.lang.String string, int ccsid)Deprecated.preferCharsets.convert(String,int)static intgetCCSID(java.lang.String codepage)Returns the CCSID corresponding to the specified codepage.static java.util.EnumerationgetCCSIDs()static java.lang.StringgetCodepage(int ccsid)Returns the codepage name corresponding to the specified CCSID.static java.nio.charset.CharsetDecodergetDecoder(int ccsid)Returns the Charset Decoder corresponding to the specified CCSID.static java.nio.charset.CharsetEncodergetEncoder(int ccsid)Returns the Charset Encoder corresponding to the specified CCSID.static com.ibm.mq.jmqi.system.JmqiCodepagegetJmqiCodepage(int ccsid)Returns the JmqiCodepage corresponding to the specified CCSID.
-
-
-
Method Detail
-
getJmqiCodepage
public static com.ibm.mq.jmqi.system.JmqiCodepage getJmqiCodepage(int ccsid) throws java.io.UnsupportedEncodingExceptionReturns the JmqiCodepage corresponding to the specified CCSID.- Parameters:
ccsid- the Coded Character Set Identifier- Returns:
- the JmqiCodepage
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID
-
getCodepage
public static java.lang.String getCodepage(int ccsid) throws java.io.UnsupportedEncodingExceptionReturns the codepage name corresponding to the specified CCSID.- Parameters:
ccsid- the Coded Character Set Identifier.- Returns:
- the codepage name
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID value
-
getCCSID
public static int getCCSID(java.lang.String codepage) throws java.io.UnsupportedEncodingExceptionReturns the CCSID corresponding to the specified codepage.- Parameters:
codepage- a valid codepage.- Returns:
- the CCSID corresponding to the specified codepage.
- Throws:
java.io.UnsupportedEncodingException- if there is no CCSID mapping for the supplied codepage.
-
getEncoder
public static java.nio.charset.CharsetEncoder getEncoder(int ccsid) throws java.io.UnsupportedEncodingExceptionReturns the Charset Encoder corresponding to the specified CCSID.- Parameters:
ccsid- the Coded Character Set Identifier.- Returns:
- the encoder
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID value
-
getDecoder
public static java.nio.charset.CharsetDecoder getDecoder(int ccsid) throws java.io.UnsupportedEncodingExceptionReturns the Charset Decoder corresponding to the specified CCSID.- Parameters:
ccsid- the Coded Character Set Identifier.- Returns:
- the decoder
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID value
-
convert
public static java.lang.String convert(byte[] bytes, int ccsid) throws java.io.UnsupportedEncodingExceptionDeprecated. preferCharsets.convert(byte[],int)Converts byte array content in the specified CCSID into a Java String.- Parameters:
bytes- the byte array to convert.ccsid- the Coded Character Set Identifier.- Returns:
- the string
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID value or the platform cannot convert from the codepage.
-
convert
public static java.lang.String convert(byte[] bytes, int offset, int length, int ccsid) throws java.io.UnsupportedEncodingExceptionDeprecated. preferCharsets.convert(byte[],int,int,int)Converts byte array content in the specified CCSID into a Java String.- Parameters:
bytes- the byte array to convert.offset- the offset in the array at which to start convertinglength- the number of bytes to convertccsid- the Coded Character Set Identifier.- Returns:
- the string
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID value or the platform cannot convert from the codepage.
-
convert
public static byte[] convert(java.lang.String string, int ccsid) throws java.io.UnsupportedEncodingExceptionDeprecated. preferCharsets.convert(String,int)Converts a Java string into a byte array in the specified CCSID.- Parameters:
ccsid- the Coded Character Set Identifier.string- the string to convert- Returns:
- the byte array
- Throws:
java.io.UnsupportedEncodingException- if there is no codepage mapping for the supplied CCSID value or the platform cannot convert from the codepage.
-
getCCSIDs
public static java.util.Enumeration getCCSIDs()
- Returns:
- the Enumeration an enumeration of the CCSID values registered. The enumeration values are type Integer.
-
-