@@ -0,0 +1,2995 @@
+/*%0A * Java SMPP API Copyright (C) 1998 - 2005 by Oran Kelly%0A * %0A * This library is free software; you can redistribute it and/or modify it under%0A * the terms of the GNU Lesser General Public License as published by the Free%0A * Software Foundation; either version 2.1 of the License, or (at your option)%0A * any later version.%0A * %0A * This library is distributed in the hope that it will be useful, but WITHOUT%0A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS%0A * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more%0A * details.%0A * %0A * You should have received a copy of the GNU Lesser General Public License%0A * along with this library; if not, write to the Free Software Foundation, Inc.,%0A * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA%0A * %0A * A copy of the LGPL can be viewed at http://www.gnu.org/copyleft/lesser.html%0A * Java SMPP API author: orank@users.sf.net Java SMPP API Homepage:%0A * http://smppapi.sourceforge.net/ $Id: UTF16Encoding.java,v 1.6 2004/12/03%0A * 17:49:47 orank Exp $%0A */%0A%0Apackage ie.omk.smpp.util;%0A%0Apublic class UTF16Encoding extends ie.omk.smpp.util.AlphabetEncoding %7B%0A    private String encType = %22UTF-16BE%22;%0A%0A    private static final int DCS = 8;%0A%0A    private static final UTF16Encoding beInstance = new UTF16Encoding(true);%0A%0A    private static final UTF16Encoding leInstance = new UTF16Encoding(false);%0A%0A    /**%0A     * Construct a new UTF16 encoding.%0A     * %0A     * @param bigEndian%0A     *            true to use UTF-16BE, false to use UTF-16LE.%0A     */%0A    private UTF16Encoding(boolean bigEndian) %7B%0A        super(DCS);%0A%0A        if (!bigEndian)%0A            encType = %22UTF-16LE%22;%0A    %7D%0A%0A    /**%0A     * Get the singleton instance of the big-endian UTF16Encoding.%0A     */%0A    public static UTF16Encoding getInstance() %7B%0A        return (beInstance);%0A    %7D%0A%0A    /**%0A     * Get the singleton instance of either the big-endian or little-endian%0A     * instance of UTF16Encoding.%0A     * %0A     * @param bigEndian%0A     *            true to get the big-endian instance, false to get the%0A     *            little-endian instance.%0A     */%0A    public static UTF16Encoding getInstance(boolean bigEndian) %7B%0A        if (bigEndian)%0A            return (beInstance);%0A        else%0A            return (leInstance);%0A    %7D%0A%0A    /**%0A     * Decode SMS message text to a Java String. The SMS message is expected to%0A     * be in UTF16 format.%0A     */%0A    public String decodeString(byte%5B%5D b) %7B%0A        if (b == null)%0A            return (%22%22);%0A%0A        try %7B%0A            return (new String(b, encType));%0A        %7D catch (java.io.UnsupportedEncodingException x) %7B%0A            return (%22%22);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Encode a Java String to bytes using UTF16.%0A     */%0A    public byte%5B%5D encodeString(String s) %7B%0A        if (s == null)%0A            return (new byte%5B0%5D);%0A%0A        try %7B%0A            return (s.getBytes(encType));%0A        %7D catch (java.io.UnsupportedEncodingException x) %7B%0A            return (new byte%5B0%5D);%0A        %7D%0A    %7D%0A%7D

Move previous UCS2Encoding behaviour into this class.