我知道如何复制粘贴文件,但只需一个按钮即可进行复制和粘贴。
static void copyFile(String readFile,String writeFile ){
try {
FileInputStream fi = null;
FileOutputStream fo = null;
try {
fi = new FileInputStream(readFile);
fo = new FileOutputStream(writeFile);
//Read File
byte[] byt = new byte[fi.available()];
int r =0;
while((r=fi.read(byt))!=-1){
//fo.write(byt);
fo.write(byt, 0, r);
}
fi.close();
fo.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
finally{
}
但是如何通过一个按钮复制并用另一个按钮粘贴?