下载图片(二进制数据)
???????? /** * 下载二进制软件 * @param urlName * @param dir * @return * @throws IOException */public static String downBin(String urlName, String dir) throws IOException {URL url = new URL(urlName);HttpURLConnection conn = (HttpURLConnection) url.openConnection();conn.connect();HttpURLConnection.setFollowRedirects(true);byte[] buf = new byte[128];BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());// 保存文件int size = 0;FileOutputStream fos = new FileOutputStream(dir);while ((size = bis.read(buf)) != -1) {fos.write(buf);}fos.flush();fos.close();return null;}?