首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

怎么避免MalformedInputException?

2014-01-26 
做了一个日志统计程序,入库的时候发生MalformedInputException,不知道怎么解决? 问题比较严重,必须避免这个

做了一个日志统计程序,入库的时候发生MalformedInputException,不知道怎么解决?

问题比较严重,必须避免这个异常,请各位大侠救命啊。

------解决方法--------------------------------------------------------
看看这个异常的说明:
Checked exception thrown when an input byte sequence is not legal for given charset, or an input character sequence is not a legal sixteen-bit Unicode sequence.

http://www.javayou.com
------解决方法--------------------------------------------------------
读文件时指定其编码
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFilePath), fileEncoding));

        

热点排行