首页天道酬勤stringreader,gzipinputstream

stringreader,gzipinputstream

张世龙 05-05 13:24 108次浏览

Jay _ 19892017-04-130933604633605115720收藏2

专栏: Java

版权

1、stringinputstream

inputstr emis=newbytearrayinputstream (str.getbytes ();

或者

bytearrayinputstreamstream=newbytearrayinputstream (str.getbytes () );

2、inputstreamstring

inputstream input=空;

string buffer out=new string buffer (;

byte[] b=new byte[4096];

for(intn; (n=input.read(b ) b )!=-1; () )。

out.append (新字符串) b,0,n );

}

return out.toString (;

3、reader字符串

bufferedreaderin=newbufferedreader (newinputstreamreader (is );

string buffer buffer=new string buffer (;

String line=' ';

while((line=in.readline ) )!=空) {

buffer.append(line;

}

return buffer.toString (;

4、字符串自述

reader reader=空值;

bufferedreaderr=newbufferedreader;

stringbuilder b=new stringbuilder (;

字符串线;

while((line=r.readline ) )!=空) {

b .应用(线路);

b.append(「\r\n”);

}

return b.toString (;

————————————————

这是CSDN博客“Jay_1989”的原创文章,符合CC 4.0 BY-SA版权合同。 请附上原文来源的链接和本声明。

原文链接: https://blog.csdn.net/Jay _ 1989/Java/article/details/70154068

string对象的方法,将string强制转换为int