package com.foreknow.domo17;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;/*** 以字节为单位对文件(图片)复制功能* FileInputStream 文件输入流(字节流)* FileOutputStream 文件输出流(字节流)* 是不是节点流?是节点流,因为构造器关联数据源*/public class CopyFile {public static void main(String[] args) {FileInputStream fis = null;FileOutputStream fos = null;try {//源文件fis = new FileInputStream("map遍历.png");//目标文件fos = new FileOutputStream("new_map.png");//读取源文件的一个字节int read = fis.read();while (read!=-1) {//将读取到的字节写到目标文件中fos.write(read);//读取下一个字节read = fis.read();}//释放资源fis.close();fos.close();} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。