Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="os"></param>
        /// <param name="ch"></param>
        /// <param name="output_encoding"></param>
        public static void encodeAndWrite(System.IO.Stream os, int ch,
                                          int output_encoding)
        {
            switch (output_encoding)
            {
            case VTDNav.FORMAT_ASCII:
                ASCII_Coder.encodeAndWrite(os, ch);
                return;

            case VTDNav.FORMAT_UTF8:
                UTF8_Coder.encodeAndWrite(os, ch);
                return;

            case VTDNav.FORMAT_ISO_8859_1:
                ISO8859_1Coder.encodeAndWrite(os, ch);
                return;

            case VTDNav.FORMAT_UTF_16LE:
                UTF16LE_Coder.encodeAndWrite(os, ch);
                return;

            case VTDNav.FORMAT_UTF_16BE:
                UTF16BE_Coder.encodeAndWrite(os, ch);
                return;

            default:
                throw new com.ximpleware.TranscodeException("Unsupported encoding");
            }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="output_encoding"></param>
        /// <returns></returns>
        public static int getLen(int ch, int output_encoding)
        {
            if (ch == 0xbe)
            {
                Console.WriteLine("0xbe");
            }
            switch (output_encoding)
            {
            case VTDNav.FORMAT_ASCII:
                return(ASCII_Coder.getLen(ch));

            case VTDNav.FORMAT_UTF8:
                return(UTF8_Coder.getLen(ch));

            case VTDNav.FORMAT_ISO_8859_1:
                return(ISO8859_1Coder.getLen(ch));

            case VTDNav.FORMAT_UTF_16LE:
                return(UTF16LE_Coder.getLen(ch));

            case VTDNav.FORMAT_UTF_16BE:
                return(UTF16BE_Coder.getLen(ch));

            default:
                throw new com.ximpleware.TranscodeException("Unsupported encoding");
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="offset"></param>
        /// <param name="input_encoding"></param>
        /// <returns></returns>
        public static long decode(byte[] input, int offset, int input_encoding)
        {
            switch (input_encoding)
            {
            case VTDNav.FORMAT_ASCII:
                return(ASCII_Coder.decode(input, offset));

            case VTDNav.FORMAT_UTF8:
                return(UTF8_Coder.decode(input, offset));

            case VTDNav.FORMAT_ISO_8859_1:
                return(ISO8859_1Coder.decode(input, offset));

            case VTDNav.FORMAT_UTF_16LE:
                return(UTF16LE_Coder.decode(input, offset));

            case VTDNav.FORMAT_UTF_16BE:
                return(UTF16BE_Coder.decode(input, offset));

            default:
                throw new com.ximpleware.TranscodeException("Unsupported encoding");
            }
        }