可以使用Apache Commons IO进行解决: InputStream is; byte[] bytes = IOUtils.toByteArray(is); 参考:Convert InputStream to byte array in Java;