public static byte[] streamToBytes(InputStream input) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int n = 0;
try {
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
}
} catch (IOException e) {
e.printStackTrace();
}
return output.toByteArray();
}
android InputStream 转byte[]
最新推荐文章于 2023-08-15 11:56:50 发布