视频下载到本地

URL urlObject = new URL("http://172.20.8.184:9080/credit-web/images/23f28a0a19614880ee29d7bb92354304.webm");
URLConnection urlConnection = urlObject.openConnection();
urlConnection.setConnectTimeout(30000);
urlConnection.setReadTimeout(30000);
urlConnection.connect();

FileUtils.writeByteArrayToFile(new File("C:\\Users\\win7\\Desktop\\网易云信\\新建文件夹\\xinde.webm"), IOUtils.toByteArray(urlConnection.getInputStream()));

用common.io的FileUtils,不能用 new File("url");这样会报错,File后只能跟路径不能跟地址

你可能感兴趣的:(视频下载到本地)