呵呵,问题出在
char lineSep = System.getProperty("line.separator").charAt(0)当初写进去的时候只用了'\n',但是读的时候用了系统的行分割符--windows下为'\r'和'\n'
所以错了。改进办法:
方法1、
写的时候:
out.writeChars(System.getProperty("line.separator"));
方法2:
读的时候:
//char lineSep = System.getProperty("line.separator").charAt(0);
char lineSep = '\n';反正保证你的encoder/decoder一致就行了
char lineSep = System.getProperty("line.separator").charAt(0)当初写进去的时候只用了'\n',但是读的时候用了系统的行分割符--windows下为'\r'和'\n'
所以错了。改进办法:
方法1、
写的时候:
out.writeChars(System.getProperty("line.separator"));
方法2:
读的时候:
//char lineSep = System.getProperty("line.separator").charAt(0);
char lineSep = '\n';反正保证你的encoder/decoder一致就行了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货