读取一个文件写入另一个文件
来源:互联网 发布:龙骑士07知乎 编辑:程序博客网 时间:2024/06/06 13:58
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
public class AsciiChart {
/**
* 从本地文件11.txt读取数据写入本地文件12.txt
*
* @author liyebing
*
*/
public static void main(String[] args) throws IOException {
//输入流
InputStream in =new FileInputStream("D:/11.doc");
//输出流
OutputStream out =new FileOutputStream("D:/12.doc",true);
try {
byte[] buffer=new byte[1024];
while(true){
int byteRead=in.read(buffer);
if(byteRead==-1)break;
out.write(buffer,0,byteRead);
}
}
catch (MalformedURLException ex) {
System.err.println(args[0] + " is not a URL Java understands.");
}
finally {
if (in != null) in.close( );
if (out != null){
out.close( );
}
}
}
}
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
public class AsciiChart {
/**
* 从本地文件11.txt读取数据写入本地文件12.txt
*
* @author liyebing
*
*/
public static void main(String[] args) throws IOException {
//输入流
InputStream in =new FileInputStream("D:/11.doc");
//输出流
OutputStream out =new FileOutputStream("D:/12.doc",true);
try {
byte[] buffer=new byte[1024];
while(true){
int byteRead=in.read(buffer);
if(byteRead==-1)break;
out.write(buffer,0,byteRead);
}
}
catch (MalformedURLException ex) {
System.err.println(args[0] + " is not a URL Java understands.");
}
finally {
if (in != null) in.close( );
if (out != null){
out.close( );
}
}
}
}
0 0
- 读取一个文件写入另一个文件
- 从一个文件读取数据然后写入另一个文件
- 从一个文件读取内容计算出结果,将结果写入到另一个文件中
- 向一个文件写入信息并读出写入另一个文件
- java读取excel文件并写入另一个excel文件
- java读取文件后修改,并写入到另一个文件
- java 把一个文件写入到另一个文件中
- 将一个文件的内容写入到另一个文件
- 从磁盘中读入一个文件并写入另一个文件
- jqeury 读取 另一个文件
- C语言逐行读取文件内容,写入另外一个文件
- python读取大文件并逐行写入另外一个文件
- 读取写入文件
- C# 读取写入文件
- 写入、读取文件
- 读取写入ini文件
- ruby读取、写入文件
- 读取写入文件内容
- nginx 根据域名打开相应首页
- Linux下套接字详解(九)---poll模式下的IO多路复用服务器
- 给table添加多个左滑按钮
- Future、Callable、FutureTask详解
- Helloworld2
- 读取一个文件写入另一个文件
- 根据偏好设置读写文件
- SQL中之Alter 和 Update的区别
- virtualBox 虚拟磁盘扩容
- 通过archiver转换对象
- C++学习笔记之vector类详解
- checkio min and max
- iOS支付宝和微信支付
- Android小经验