java 读写文件
来源:互联网 发布:域名要实名认证吗 编辑:程序博客网 时间:2024/05/16 12:48
package io;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import javax.sound.sampled.Line;
/** * @author yixin.fso.wuwh
* @date createTime*/
public class Test {
public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException {
Reader is = new FileReader("C:\\Users\\Administrator.GFYJ\\Desktop\\Test.java");
BufferedReader br = new BufferedReader(is);
String buffer = null;
OutputStream fos = new FileOutputStream("C:\\Users\\Administrator.GFYJ\\Desktop\\1");
while((buffer=br.readLine())!=null)
{
//System.out.println("武钊"+buffer);
fos.write((buffer+"\n").getBytes());
fos.write("\n".getBytes());
}
// InputStream is = new FileInputStream("C:\\Users\\Administrator.GFYJ\\Desktop\\Test.java");
// OutputStream fos = new FileOutputStream("C:\\Users\\Administrator.GFYJ\\Desktop\\1");
//
//
// byte[] bytes = new byte[64];
// int hasRead = 0;
// while((hasRead = is.read(bytes))>0)
// {
// fos.write(bytes, 0, hasRead);
// }
/* String newString = new String(bytes.toString());
System.out.println(newString);*/
}
}
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import javax.sound.sampled.Line;
/** * @author yixin.fso.wuwh
* @date createTime*/
public class Test {
public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException {
Reader is = new FileReader("C:\\Users\\Administrator.GFYJ\\Desktop\\Test.java");
BufferedReader br = new BufferedReader(is);
String buffer = null;
OutputStream fos = new FileOutputStream("C:\\Users\\Administrator.GFYJ\\Desktop\\1");
while((buffer=br.readLine())!=null)
{
//System.out.println("武钊"+buffer);
fos.write((buffer+"\n").getBytes());
fos.write("\n".getBytes());
}
// InputStream is = new FileInputStream("C:\\Users\\Administrator.GFYJ\\Desktop\\Test.java");
// OutputStream fos = new FileOutputStream("C:\\Users\\Administrator.GFYJ\\Desktop\\1");
//
//
// byte[] bytes = new byte[64];
// int hasRead = 0;
// while((hasRead = is.read(bytes))>0)
// {
// fos.write(bytes, 0, hasRead);
// }
/* String newString = new String(bytes.toString());
System.out.println(newString);*/
}
}
0 0
- java 读写ini文件
- java读写文件
- Java读写文件方法
- java 读写属性文件
- JAVA同时读写文件
- java 文件读写
- java文件读写
- JAVA IO读写文件
- java读写磁盘文件
- Java gzip文件读写
- Java读写Zip文件
- java读写文件
- java读写文件大全
- java 读写 ini 文件
- JAVA 文件读写
- java 读写文件大全
- java 读写文件大全
- java文件读写
- 4.9
- Junit4常用注解
- python 2.6 pip install mysql-python 报错
- Doc14(表格单数行变色及点击变色)
- 数据结构基础(1) --Swap & Bubble-Sort & Select-Sort
- java 读写文件
- cycript和.a静态库
- 项目前端部分小结
- 【Boost】boost库中function的用法
- 4.10
- swift学习笔记二
- css3伪元素
- css学习笔记20160128对齐组合选择符伪类伪元素
- 头像上面有文字。