读取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();
	}
 

猜你喜欢

转载自zwnjava.iteye.com/blog/1676839