文件复制代码实现
FileInputStream input = new FileInputStream(new File("d.txt"));
FileOutputStream out = new FileOutputStream(new File("d2.txt"));
int temp = 0; //读写标记位
while((temp = input.read()) != -1){ //如果文件读入还有内容,循环读取
out.write(temp);
}
input.close();
out.close(); |
|