Java流
1.输入流转字节数组
public static byte[] inputStream2byte(InputStream inputStream) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byte[] buff = new byte[100]; int n = 0; while ((n = inputStream.read(buff, 0, 100)) > 0) { byteArrayOutputStream.write(buff, 0, n); } return byteArrayOutputStream.toByteArray(); }
感谢您的阅读,您的支持是我写博客动力。