public static String encode(String data, String
charEncoding)
        throws UnsupportedEncodingException {

        // Check arguments
        if (data == null) {
            data = "";
        }
        if (charEncoding == null) {
            charEncoding = DEFAULT_CHAR_ENCODING;
        }

        // Convert to byte[]
        ByteArrayOutputStream bos = new
ByteArrayOutputStream();
        OutputStreamWriter osw = new
OutputStreamWriter(bos, charEncoding);
        try {
            osw.write(data);
//*****should add start*********
            osw.flush()
//*****should add end*********

        } catch (IOException ioe) {
            throw new
RuntimeException(ioe.toString());
        }

        // Encode
        byte[] encodedData =
encode(bos.toByteArray());


_________________________________________________________
Do You Yahoo!? 
暑期大片齐聚雅虎通 网络摄像头+雅虎通调频收音机等你来拿
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.promo.yahoo.com/minisite/messenger1/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to