- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- public class CopyFile {
- /**
- * @param args
- * @throws IOException
- */
- private static final int BUFFER_SIZE = 1024;
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- FileCopy();
- }
- public static void FileCopy() throws IOException {
- // TODO Auto-generated method stub
-
-
- FileInputStream fis = new FileInputStream("e:\\Waiting For Copy.jpg");
- FileOutputStream fos = new FileOutputStream("e:\\Copy File.jpg");
-
- byte[] buf = new byte[BUFFER_SIZE];
-
- int len = 0;
-
- while((len=fis.read(buf))!=-1){
- fos.write(buf,0,len);
- }
-
- fos.close();
- fis.close();
-
- }
- }
复制代码 |