/** * 獲取 文件 流 * * @param targetPicUrl 網(wǎng)絡(luò)圖片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(); //通過輸入流獲取圖片數(shù)據(jù) }catch (Exception e){ log.error("獲取圖片流失敗:{}",e.getMessage()); } return inStream; }
浙公網(wǎng)安備 33010602011771號(hào)