FileInputStream fis = new FileInputStream("D:\\a\\cc.jpg"); File file=new File("D:\\a"); String wjmc = "dd.jpg"; //在扩展名前增加字符串 wjmc = wjmc.replaceAll("(\\.)", "_sign$1"); //或者这样写 String new_string = wjmc.substring(0, wjmc.lastIndexOf(".")) + "_sign" + wjmc.substring(wjmc.lastIndexOf(".")); File file1=new File(file,wjmc); FileOutputStream fos = new FileOutputStream(file1); int len = 0; byte[] bytes = new byte[1024]; while ((len=fis.read(bytes))!=-1) fos.write(bytes,0,len); fis.close(); fos.close();
io流输出
最新推荐文章于 2022-12-12 20:00:42 发布