import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileCopyExample {
public static void main(String[] args) {
try {
FileInputStream sourceFile = new FileInputStream("sourceFile.txt");
FileOutputStream destinationFile = new FileOutputStream("destinationFile.txt");
byte[] buffer = new byte[1024];
int length;
while ((length = sourceFile.read(buffer)) > 0) {
destinationFile.write(buffer, 0, length);
}
sourceFile.close();
destinationFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
797

被折叠的 条评论
为什么被折叠?



