package com.tianmushanlu.util;
import java.nio.charset.Charset;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 编码格式转化
*
*
*
*/
public class CharSetUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CharSetUtil.class);
public static Charset chatset(String charsetName) {
Charset code = null;
try {
if(StringUtils.isBlank(charsetName)) {
return code;
}
code = Charset.forName(charsetName);
} catch (Exception e) {
code = null;
LOGGER.error("失败 :", charsetName);
}
return code;
}
public static void main(String[] args) {
Charset chatset = chatset("gbk");
System.out.println(chatset);
}
}
编码格式转化
最新推荐文章于 2024-08-20 16:29:10 发布
2072

被折叠的 条评论
为什么被折叠?



