首页天道酬勤java ioexception,string转list

java ioexception,string转list

张世龙 05-05 13:18 74次浏览

1、从字符串转换为InputStream //str1字符串inputstreminputstrem=newbytearrayinputstream (str1. getbytes ) ); 或者

bytearrayinputstreambytearrayinputstream=newbytearrayinputstream (str1. getbytes (); 2、从InputStream转换为stringinputstreaminputstream=null; string buffer string buffer=new string buffer (; byte[] byt=new byte[4096]; for(intI; (I=input.read(byt )!=-1; (stringbuffer.append(newstring ) byt,0,I ); } return stringBuffer.toString (;

inputstream实例,int转string的方法