public class InputStreamUtil {
/**
* 读取流中的数据转换为byte数组
* @param in
* @return
* @throws Exception
*/
public static byte[] getBytes(InputStream in) throws Exception{
ByteArrayOutputStream byteOs = new ByteArrayOutputStream();
int data = 0;
try {
while ((data = in.read()) != -1) {
byteOs.write(data);
}
} catch (Exception e) {
throw e;
}
return byteOs.toByteArray();
}
}
inputStreamUtil
最新推荐文章于 2021-12-28 19:31:48 发布