当前位置:网站首页>文件拷贝的实现
文件拷贝的实现
2020-11-08 21:03:00 【8Years】
public class TestIO01 {
public static void main(String[] args) {
copy("D:/aaa.txt","D:/B.txt");//把前者文件的内容拷贝到后者文件中qu
}
public static void copy(String srcfile,String destpath) {
File file=new File(srcfile);
File file1=new File(destpath);
InputStream is=null;
OutputStream os=null;
try {
is=new FileInputStream(file);
os=new FileOutputStream(file1);
byte[] car=new byte[3];
int temp;
int len;
while((len=is.read(car))!=-1){
os.write(car,0, len);
String str=new String(car,0,len);
}
os.flush();
} catch (FileNotFoundException fileNotFoundException) {
fileNotFoundException.printStackTrace();
} catch (IOException ioException) {
ioException.printStackTrace();
}finally{
try{
if(is!=null){
is.close();
}
}catch (IOException ioException){
ioException.printStackTrace();
}
try{
if(is!=null){
is.close();
}
}catch (IOException ioException){
ioException.printStackTrace();
}
}
}
}
版权声明
本文为[8Years]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4583813/blog/4707700
边栏推荐
- [random talk] JS related thread model sorting
- abp(net core)+easyui+efcore实现仓储管理系统——出库管理之五(五十四)
- SQL 速查
- Iptables from introduction to mastery
- Chapter five
- .NET Core 跨平台资源监控库及 dotnet tool 小工具
- Part I - Chapter 1 Overview
- Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020
- To introduce to you, this is my flow chart software—— draw.io
- Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020
猜你喜欢

Dynamic ReLU:微软推出提点神器,可能是最好的ReLU改进 | ECCV 2020

不是程序员,代码也不能太丑!python官方书写规范:任何人都该了解的 pep8

Tasks of the first week of information security curriculum design (analysis of 7 instructions)

Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020

Creating a text cloud or label cloud in Python

新手入坑指南:工作原因“重启”Deepin系统,发现真的香啊

给大家介绍下,这是我的流程图软件 —— draw.io

Programmers should know the URI, a comprehensive understanding of the article

Looking for better dynamic getter and setter solutions

Simulink中封装子系统
随机推荐
WordPress网站程序和数据库定时备份到七牛云图文教程
Process thread coroutine
在Python中创建文字云或标签云
选择API管理平台之前要考虑的5个因素
[200 interview experience], programmer interview, common interview questions analysis
JVM真香系列:轻松理解class文件到虚拟机(下)
Python 列表的11个重要操作
单例模式的五种设计方案
Dynamic relu: Microsoft's refreshing device may be the best relu improvement | ECCV 2020
Classical dynamic programming: longest common subsequence
Programmers should know the URI, a comprehensive understanding of the article
C / C + + knowledge sharing: function pointer and pointer function, can you understand after reading this article?
MongoDB数据库
Implementation of warehouse management system with ABP (net core) + easyUI + efcore
Mycat搭建
CMS垃圾收集器
Dynamic planning
Tasks of the first week of information security curriculum design (analysis of 7 instructions)
How to deploy pytorch lightning model to production
简明 VIM 练级攻略