package com.taobao.tae.Mshopping.demo.util;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
*
* <P></P>
* User: <a href="mailto:xhm.xuhm@alibaba-inc.com">苍旻</a>
* Date: 14-2-20
* Time: 上午10:52
*/
public class ResponseUtils {
/**
* 读取流
*
* @param inStream
* @return 字节数组
* @throws Exception
*/
public static byte[] readStream(InputStream inStream) throws IOException {
ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = -1;
while ((len = inStream.read(buffer)) != -1) {
outSteam.write(buffer, 0, len);
}
outSteam.close();
inStream.close();
return outSteam.toByteArray();
}
}