Module openj9.dtfj

Class CharConversion


  • public class CharConversion
    extends Object
    This class provides some handy character conversion methods
    • Constructor Detail

      • CharConversion

        public CharConversion()
    • Method Detail

      • getEbcdicBytes

        public static byte[] getEbcdicBytes​(String s)
        Convert the given String to ebcdic bytes
        Parameters:
        s - the String to be converted
        Returns:
        the ebcdic byte array
      • getEbcdicString

        public static String getEbcdicString​(byte[] buf,
                                             int offset,
                                             int length)
        Convert an array of ebcdic bytes to a String
        Parameters:
        buf - the array of ebcdic bytes
        offset - the offset within the array where the bytes to be converted start
        length - the number of bytes to convert
        Returns:
        the converted String
      • getEbcdicChar

        public static char getEbcdicChar​(byte b)
      • getEbcdicString

        public static String getEbcdicString​(byte[] buf)
        Convert an array of ebcdic bytes to a String
        Parameters:
        buf - the array of ebcdic bytes
        Returns:
        the converted String
      • nullTerminate

        public static byte[] nullTerminate​(byte[] buf)
        Null terminates the given array.
        Parameters:
        buf - the array to be null terminated
        Returns:
        a copy of the array but with an extra zero byte at the end