1,一个读一个写;(接受的写)
public class Text {public static void main(String[] args) throws IOException {//创建输入流:FileInputStream fis = new FileInputStream("C:\\Users\\14535\\Pictures\\素材\\mwp_2111_1200x2300_logo2.png");//创建输出流:一定是要文件啊FileOutputStream fos = new FileOutputStream("G:\\xxx.png");//创建存储数据的数组byte[] bytes = new byte[1024 * 8];//定义变量存储读取数据的长度;int len;//循环读取数据while ((len = fis.read(bytes)) != -1) {fos.write(bytes, 0, len);}//关闭流fos.close();fis.close();}}
