streamtostring,
分享于 点击 48632 次 点评:111
streamtostring,
package com.baway.renjue.utils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; /** * @author 任珏 * @类的用途 输入流转为字符串的工具类 * @date 2017/4/5 9:13 */ public class StreamUtils { public static String streamToString(InputStream stream){ ByteArrayOutputStream outputStream=new ByteArrayOutputStream(); byte[] b=new byte[1024]; int len=0; try { while((len=stream.read(b))!=-1){ outputStream.write(b,0,len); } return outputStream.toString(); } catch (IOException e) { e.printStackTrace(); } return null; } }
相关文章
- 暂无相关文章
用户点评