作者在 2010-05-21 14:13:57 发布以下内容
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyFile{
public static void main(String[] args) {
try {
FileInputStream fis = new FileInputStream ("a.jpg");//本地中存在的文件
FileOutputStream fos = new FileOutputStream ("temp.jpg");
int read = fis.read();
while ( read != -1 ) {
fos.write(read);
read = fis.read();
}
fis.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyFile{
public static void main(String[] args) {
try {
FileInputStream fis = new FileInputStream ("a.jpg");//本地中存在的文件
FileOutputStream fos = new FileOutputStream ("temp.jpg");
int read = fis.read();
while ( read != -1 ) {
fos.write(read);
read = fis.read();
}
fis.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}