import java.io.*;
public class BinaryFileCopy {
public static void main(String[] args) {
try {
// 创建输入流和输出流
FileInputStream in = new FileInputStream("input.bin");
FileOutputStream out = new FileOutputStream("output.bin");
// 读取和写入数据
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
// 关闭流
in.close();
out.close();
System.out.println("文件复制成功!");
} catch (IOException e) {
e.printStackTrace();
}
}
}