要把文件中的所有的字节都读进来之后才能转换成String,
你可以这么写:
ByteArrayOutputStream strOut = new ByteArrayOutputStream();
int c;
c = in.read();
while(c!=-1)
{ strOut.write(c);c=in.read();}
String out = new String(strOut.toByteArray(),"gb2312");
你可以这么写:
ByteArrayOutputStream strOut = new ByteArrayOutputStream();
int c;
c = in.read();
while(c!=-1)
{ strOut.write(c);c=in.read();}
String out = new String(strOut.toByteArray(),"gb2312");
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货