You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by liu jie <cn...@yahoo.com.cn> on 2003/07/22 07:25:50 UTC
org.apache.commons.codec.base64 bug, i coreect,anyone can notify the committer
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