avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu jie <cn_liu...@yahoo.com.cn>
Subject org.apache.commons.codec.base64 bug, i coreect,anyone can notify the committer
Date Tue, 22 Jul 2003 05:25:50 GMT
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: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message