字节流实现文件的复制
FileInputStream file1 = new FileInputStream("E:/abc/hello.txt"); FileOutputStream file2 = new FileOutputStream("E:/cba/hello.txt"); int i = 0; while((i = file1.read())!=-1){ file2.write(i); } file1.close(); file2.close(); FileInputStream file3 = new FileInputStream("E:/cba/hello.txt"); int y = 0; while((y = file3.read())!=-1){ System.out.println((char)y); } file3.close();
浙公网安备 33010602011771号