/** * 获取 文件 流 * * @param targetPicUrl 网络图片url * @return * @throws IOException */ private InputStream getFile(String targetPicUrl) { InputStream inStream = null; try { URL urlConet = new URL(targetPicUrl); HttpURLConnection con = (HttpURLConnection) urlConet.openConnection(); con.setRequestMethod("GET"); con.setConnectTimeout(4 * 1000); inStream = con.getInputStream(); //通过输入流获取图片数据 }catch (Exception e){ log.error("获取图片流失败:{}",e.getMessage()); } return inStream; }
浙公网安备 33010602011771号