⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filecopy.java

📁 合并几个数据库结构相同的数据库文件。hsql数据库文件合并
💻 JAVA
字号:
package merge;

import java.nio.channels.*;
import java.io.*;

public class FileCopy{ 
	public static void main(String args[]){   
		try {  
			FileCopy j = new FileCopy();    
			j.copyFile(new File("1.txt"),new File("1copy.txt"));  
			File f=new File("1copy.txt");
			f.renameTo(new File("1c.txt"));
		}catch (Exception e) {   
			e.printStackTrace();    
		}
		}  
	public void copyFile(File in, File out) throws Exception {   
		FileChannel sourceChannel = new FileInputStream(in).getChannel();   
		FileChannel destinationChannel = new FileOutputStream(out).getChannel();  
		sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);  
		// or    
		// destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); 
		sourceChannel.close();    
		destinationChannel.close();   
		} 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -