Package com.ibm.mq.headers
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 TypeMethodDescriptionstatic Stringconvert(byte[] bytes, int ccsid) Converts byte array content in the specified CCSID into a Java String.static Stringconvert(byte[] bytes, int ccsid, int encoding, boolean noTrace) Converts byte array content in the specified CCSID into a Java String.static Stringconvert(byte[] bytes, int offset, int length, int ccsid) Converts byte array content in the specified CCSID into a Java String.static Stringconvert(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[]Converts a Java string into a byte array in the specified CCSID.static Stringconvert(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
-
Method Details
-
convert
Converts byte array content in the specified CCSID into a Java String.- Parameters:
bytes- The data to convertccsid- 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 convertccsid- The Coded Character Set IDencoding- The encoding of the header, relevant for CCSID 1200 character encodingsnoTrace- - 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 convertoffset- The offset in the byte array from where the conversion beginlength- The number of bytes from the offset to convertccsid- 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 convertoffset- The offset in the byte array from where the conversion beginlength- The number of bytes from the offset to convertccsid- The Coded Character Set ID to be used for conversionencoding- The encoding to use for numeric data conversionnoTrace- - 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 convertoffset- The offset in the byte array from where the conversion beginlength- The number of bytes from the offset to convertccsid- 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
Converts a Java string into a byte array in the specified CCSID.- Parameters:
string- The input string to convertccsid- 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
Converts a SecureString into a byte array in the specified CCSID.- Parameters:
string- An instance of SecureString classccsid- 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.
-