Class CCSID

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

public class CCSID extends 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 Details

    • CCSID

      public CCSID()
  • Method Details

    • getJmqiCodepage

      public static com.ibm.mq.jmqi.system.JmqiCodepage getJmqiCodepage(int ccsid) throws UnsupportedEncodingException
      Returns the JmqiCodepage corresponding to the specified CCSID.
      Parameters:
      ccsid - the Coded Character Set Identifier
      Returns:
      the JmqiCodepage
      Throws:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID
    • getCodepage

      public static String getCodepage(int ccsid) throws UnsupportedEncodingException
      Returns the codepage name corresponding to the specified CCSID.
      Parameters:
      ccsid - the Coded Character Set Identifier.
      Returns:
      the codepage name
      Throws:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID value
    • getCCSID

      public static int getCCSID(String codepage) throws UnsupportedEncodingException
      Returns the CCSID corresponding to the specified codepage.
      Parameters:
      codepage - a valid codepage.
      Returns:
      the CCSID corresponding to the specified codepage.
      Throws:
      UnsupportedEncodingException - if there is no CCSID mapping for the supplied codepage.
    • getEncoder

      public static CharsetEncoder getEncoder(int ccsid) throws UnsupportedEncodingException
      Returns the Charset Encoder corresponding to the specified CCSID.
      Parameters:
      ccsid - the Coded Character Set Identifier.
      Returns:
      the encoder
      Throws:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID value
    • getDecoder

      public static CharsetDecoder getDecoder(int ccsid) throws UnsupportedEncodingException
      Returns the Charset Decoder corresponding to the specified CCSID.
      Parameters:
      ccsid - the Coded Character Set Identifier.
      Returns:
      the decoder
      Throws:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID value
    • convert

      public static String convert(byte[] bytes, int ccsid) throws UnsupportedEncodingException
      Deprecated.
      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:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID value or the platform cannot convert from the codepage.
    • convert

      public static String convert(byte[] bytes, int offset, int length, int ccsid) throws 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:
      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(String string, int ccsid) throws UnsupportedEncodingException
      Deprecated.
      Converts a Java string into a byte array in the specified CCSID.
      Parameters:
      string - the string to convert
      ccsid - the Coded Character Set Identifier.
      Returns:
      the byte array
      Throws:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID value or the platform cannot convert from the codepage.
    • getCCSIDs

      public static Enumeration getCCSIDs()
      Returns:
      the Enumeration an enumeration of the CCSID values registered. The enumeration values are type Integer.