Class EbcdicCcsidManager


  • class EbcdicCcsidManager
    extends CcsidManager
    A concrete implementation of a CcsidMgr used to convert between Java UCS2 and Ebcdic as needed to handle character DDM Parameters. This implementation only supports converting from the ASCII invariant of UNICODE to Ebcdic. This should be fine since this class is intended for converting DDM Parameter data only.
    • Field Detail

      • conversionArrayToEbcdic

        private static final int[] conversionArrayToEbcdic
      • conversionArrayToUCS2

        private static final int[] conversionArrayToUCS2
    • Constructor Detail

      • EbcdicCcsidManager

        public EbcdicCcsidManager()
    • Method Detail

      • encode

        public boolean encode​(java.nio.CharBuffer src,
                              java.nio.ByteBuffer dest,
                              Agent agent)
                       throws SqlException
        Description copied from class: CcsidManager
        Encode the contents of a CharBuffer into a ByteBuffer. The method will return true if all the characters were encoded and copied to the destination. If the receiving byte buffer is too small to hold the entire encoded representation of the character buffer, the method will return false. The caller should then allocate a larger byte buffer, copy the contents from the old byte buffer to the new one, and then call this method again to get the remaining characters encoded.
        Specified by:
        encode in class CcsidManager
        Parameters:
        src - buffer holding the characters to encode
        dest - buffer receiving the encoded bytes
        agent - where to report errors
        Returns:
        true if all characters were encoded, false if the destination buffer is full and there still are more characters to encode
        Throws:
        SqlException - if the characters cannot be encoded using this CCSID manager's character encoding
      • convertToJavaString

        java.lang.String convertToJavaString​(byte[] sourceBytes,
                                             int offset,
                                             int numToConvert)
        Specified by:
        convertToJavaString in class CcsidManager