`
zwnJava
  • 浏览: 206035 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

读取InputStream

阅读更多

读取InputSteam中的内容

 

	public static byte[] read(InputStream is) throws Exception {
		ByteArrayOutputStream os = new ByteArrayOutputStream();
		byte[] buffer = new byte[1024];
		int len = 0;
		while ((len = is.read(buffer)) != -1) {
			os.write(buffer, 0, len);
		}
		is.close();
		return os.toByteArray();
	}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics