>>>>>>>>>>
说明:把图片从C盘复制到D盘。
package IO; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; /** * 图片转移 * @author 潇洒鸿图 * */ public class BufferedWriterr { public static void main(String[] args) throws IOException { FileInputStream input = new FileInputStream ("C:\666.jpeg"); DataInputStream dis = new DataInputStream (input); FileOutputStream output = new FileOutputStream("D:\666.jpeg"); DataOutputStream dos = new DataOutputStream(output); byte[] b = new byte[1024]; /*read方法读取并放到b数组中*/ while (dis.read(b)!= -1) { dos.write(b); } dis.close(); input.close(); dos.close(); output.close(); System.out.println("提示:图片转移成功!"); }/*main*/ }
>>>>>>>>>>