public static void CreateDBFile(String dbpath, String dbname) {
try {
File f = new File(dbpath);
if (!f.exists()) {
// Create channel on the sourcedbpath
FileChannel srcChannel = new FileInputStream(readValue("dbPath")+dbname).getChannel();
// Create channel on the destination
FileChannel dstChannel = new FileOutputStream(dbpath).getChannel();
// Copy file contents from source to destination
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
// Close the channels
srcChannel.close();
dstChannel.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
JAVA拷贝文件
最新推荐文章于 2024-06-18 06:15:00 发布