标签:desktop sts ace except ted read 输入 string static
public class asd {
private static void customBufferStreamCopy(String source, String target) {
InputStream fis = null;
OutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(target);
byte[] buf = new byte[4096];
int i;
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
}
catch (Exception e) {
e.printStackTrace(); }
finally {
try {
fis.close();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void main(String[] args) {
File f=new File("C:/Users/Administrator/Desktop/biji4.txt");
if(f.exists()){}
else {
try {
f.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
new asd();
asd.customBufferStreamCopy("C:/Users/Administrator/Desktop/biji4.txt", "C:/Users/Administrator/Desktop/biji3.txt");
}
}
标签:desktop sts ace except ted read 输入 string static
原文地址:http://www.cnblogs.com/zhaosong-0102/p/7375331.html