您的位置:首页 > 其它

安卓输入流转String

2017-03-16 18:43 85 查看
安卓输入流转String:

package utils;

import java.io.ByteArrayOutputStream;

import java.io.IOException;

import java.io.InputStream;

/*

*

*/

public class StreamUtils {

/*

*/

public static String readFromStream(InputStream in) throws IOException{

ByteArrayOutputStream out=new ByteArrayOutputStream();

int len=0;

byte[] buffer=new byte[1024];

while((len=in.read(buffer))!=-1){

out.write(buffer,0,len);

}
String result = out.toString();
in.close();
out.close();
return result;


}

}

本人个人项目地址:百度搜索安卓应用—-点击进入百度应用市场—搜索”电话老人版”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐