标签:puts while red pre try 下载 rgba rgs print
public static void main(String[] args) { FileOutputStream fos = null; BufferedInputStream bis = null; HttpURLConnection httpUrl = null; int size = 0; byte[] buf = new byte[1024]; File file = new File("E:/" + "1.jpg"); try { URL url = new URL("https://images.cnblogs.com/cnblogs_com/qq1445496485/1909145/o_2103030645361045.jpg"); httpUrl = (HttpURLConnection)url.openConnection(); httpUrl.connect(); bis = new BufferedInputStream(httpUrl.getInputStream()); fos = new FileOutputStream(file); while ((size = bis.read(buf)) != -1) { fos.write(buf, 0, size); } fos.flush(); fos.close(); bis.close(); } catch (Exception e) { e.printStackTrace(); } }
标签:puts while red pre try 下载 rgba rgs print
原文地址:https://www.cnblogs.com/qq1445496485/p/14844464.html