文件复制
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("G:\\test.txt");
fos = new FileOutputStream("G:\\text.txt");
byte[] bt = new byte[1024];
int len = 0;
while ((len = fis.read(bt)) != -1) {
fos.write(bt, 0, len);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fis != null)
fis.close();
if (fos != null)
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
如有错误请告知