*
* @param file
* @return
*/
public static String getFileEncodingCharset(InputStream is) {
CodepageDetectorProxy detector = CodepageDetectorProxy.getInstance();
detector.add(JChardetFacade.getInstance());
try {
Charset charset = Charset.forName(ResourceHelper.defaultFileEncoding());
try {
charset = detector.detectCodepage(is, 2147483647);
} catch (IllegalArgumentException e) {
charset = Charset.forName(ResourceHelper.defaultFileEncoding());
JTesterLogger.warn("get file encoding error:" + e.getMessage() + ", use default encoding:"
+ ResourceHelper.defaultFileEncoding());
}