com.ibm.mq.headers

Class CCSID

  • java.lang.Object
    • com.ibm.mq.headers.CCSID
  • Direct Known Subclasses:
    CCSID


    public class CCSID
    extends java.lang.Object
    Utility 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.String convert(byte[] bytes, int ccsid)
      Deprecated. 
      static java.lang.String convert(byte[] bytes, int offset, int length, int ccsid)
      static byte[] convert(java.lang.String string, int ccsid)
      Deprecated. 
      static int getCCSID(java.lang.String codepage)
      Returns the CCSID corresponding to the specified codepage.
      static java.util.Enumeration getCCSIDs() 
      static java.lang.String getCodepage(int ccsid)
      Returns the codepage name corresponding to the specified CCSID.
      static java.nio.charset.CharsetDecoder getDecoder(int ccsid)
      Returns the Charset Decoder corresponding to the specified CCSID.
      static java.nio.charset.CharsetEncoder getEncoder(int ccsid)
      Returns the Charset Encoder corresponding to the specified CCSID.
      static com.ibm.mq.jmqi.system.JmqiCodepage getJmqiCodepage(int ccsid)
      Returns the JmqiCodepage corresponding to the specified CCSID.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CCSID

        public CCSID()
    • Method Detail

      • getJmqiCodepage

        public static com.ibm.mq.jmqi.system.JmqiCodepage getJmqiCodepage(int ccsid)
                                                                   throws java.io.UnsupportedEncodingException
        Returns 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.UnsupportedEncodingException
        Returns 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.UnsupportedEncodingException
        Returns 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.UnsupportedEncodingException
        Returns 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.UnsupportedEncodingException
        Returns 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.UnsupportedEncodingException
        Deprecated. prefer Charsets.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.UnsupportedEncodingException
        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 converting
        length - the number of bytes 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 byte[] convert(java.lang.String string,
                                     int ccsid)
                              throws java.io.UnsupportedEncodingException
        Deprecated. prefer Charsets.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.
(c) Copyright IBM Corp. 2008, 2016. All Rights Reserved.