檔案,圖片FIle
阿新 • • 發佈:2021-02-02
String path = "E:\\ceshi\\gongshi.png"; File file=new File(path); InputStream fis = new FileInputStream(file); OutputStream fos = new FileOutputStream(new File("E:\\ceshi\\gongshi2.png")); int a = 0; byte[] temp = new byte[100]; while((a = fis.read(temp))>0){ int b = 0; b+=a; fos.write(temp,0,b); } fos.flush(); fis.close(); fos.close();