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
最新推荐文章于 2025-05-13 16:45:44 发布