Class Charsets

java.lang.Object
com.ibm.mq.jmqi.JmqiObject
com.ibm.mq.headers.Charsets

public class Charsets extends com.ibm.mq.jmqi.JmqiObject
Class to do NIO Charset based conversion of data in Headers
  • Field Summary

    Fields inherited from class com.ibm.mq.jmqi.JmqiObject

    COMP_JM, COMP_JN, COMP_JO
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    convert(byte[] bytes, int ccsid)
    Converts byte array content in the specified CCSID into a Java String.
    static String
    convert(byte[] bytes, int ccsid, int encoding, boolean noTrace)
    Converts byte array content in the specified CCSID into a Java String.
    static String
    convert(byte[] bytes, int offset, int length, int ccsid)
    Converts byte array content in the specified CCSID into a Java String.
    static String
    convert(byte[] bytes, int offset, int length, int ccsid, int encoding, boolean noTrace)
    Converts byte array content in the specified CCSID into a Java String.
    static byte[]
    convert(SecureString string, int ccsid)
    Converts a SecureString into a byte array in the specified CCSID.
    static byte[]
    convert(String string, int ccsid)
    Converts a Java string into a byte array in the specified CCSID.
    static String
    convert(ByteBuffer bytes, int offset, int length, int ccsid)
    Converts ByteBuffer content in the specified CCSID into a Java String.

    Methods inherited from class com.ibm.mq.jmqi.JmqiObject

    getJmqiEnvironment

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • convert

      public static String convert(byte[] bytes, int ccsid) throws UnsupportedEncodingException
      Converts byte array content in the specified CCSID into a Java String.
      Parameters:
      bytes - The data to convert
      ccsid - The Coded Character Set ID
      Returns:
      The data as a Unicode 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 ccsid, int encoding, boolean noTrace) throws UnsupportedEncodingException
      Converts byte array content in the specified CCSID into a Java String.
      Parameters:
      bytes - The data to convert
      ccsid - The Coded Character Set ID
      encoding - The encoding of the header, relevant for CCSID 1200 character encodings
      noTrace - - Don't trace confidential data like passwords. Actual value replaced with ********.
      Returns:
      The data as a Java 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 input byte array data to convert
      offset - The offset in the byte array from where the conversion begin
      length - The number of bytes from the offset to convert
      ccsid - The Coded Character Set ID to be used for conversion
      Returns:
      the resulting 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, int encoding, boolean noTrace) throws UnsupportedEncodingException
      Converts byte array content in the specified CCSID into a Java String.
      Parameters:
      bytes - The input byte array data to convert
      offset - The offset in the byte array from where the conversion begin
      length - The number of bytes from the offset to convert
      ccsid - The Coded Character Set ID to be used for conversion
      encoding - The encoding to use for numeric data conversion
      noTrace - - Don't trace confidential data like passwords. Actual value replaced with ********.
      Returns:
      the resulting 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(ByteBuffer bytes, int offset, int length, int ccsid) throws UnsupportedEncodingException
      Converts ByteBuffer content in the specified CCSID into a Java String.
      Parameters:
      bytes - The input byte array data to convert
      offset - The offset in the byte array from where the conversion begin
      length - The number of bytes from the offset to convert
      ccsid - The Coded Character Set ID
      Returns:
      the resulting 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
      Converts a Java string into a byte array in the specified CCSID.
      Parameters:
      string - The input string to convert
      ccsid - The Coded Character Set ID to be used for conversion
      Returns:
      the resulting byte array
      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(SecureString string, int ccsid) throws UnsupportedEncodingException
      Converts a SecureString into a byte array in the specified CCSID.
      Parameters:
      string - An instance of SecureString class
      ccsid - The Coded Character Set ID to be used for conversion
      Returns:
      the resulting byte array
      Throws:
      UnsupportedEncodingException - if there is no codepage mapping for the supplied CCSID value or the platform cannot convert from the codepage.