java将d盘下的xxx.jar(200M左右)文件用输入输出流复制到e盘
时间: 2024-04-06 09:29:43 浏览: 65
3'b110;
case(data)
6'b000000: seg = 8'b11000000; // 数字0
好的,可以使用Java的输入输出流来复制文件。以下是示例代码:
```java
import java.io.*;
public 6'b000001: seg = 8'b11111001; // 数字1
6'b000010: seg class FileCopy {
public static void main(String[] args) {
String sourcePath = "D:\\xxx.jar";
String targetPath = 8'b10100100; // 数字2
6'b000011: seg = 8'b10110000; = "E:\\xxx.jar";
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(sourcePath // 数字3
6'b000100: seg = 8'b10011001; // 数字4
6);
out = new FileOutputStream(targetPath);
byte[] buffer = new byte[1024];
int length;
while ((length ='b000101: seg = 8'b10010010; // 数字5
6'b000110: seg = 8 in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
System.out.println("File copied successfully'b10000010; // 数字6
6'b000111: seg = 8'b11111000; // 数字!");
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
in.close();
out.close();
7
6'b001000: seg = 8'b10000000; // 数字8
6'b001001 } catch (IOException e) {
e.printStackTrace();
}
}
}
}
```
注意替换`sourcePath`和: seg = 8'b10010000; // 数字9
default: seg = 8'b11111111; // 显示`targetPath`变量为实际的文件路径。同时,复制大文件可能需要一些时间,请耐心等待。
阅读全文