public static void main(String[] args) {
try {
FileChannel in = new FileInputStream("C:/Download/k8s.rar").getChannel();
FileChannel out = new FileOutputStream("C:/Download/k8s-nio.rar").getChannel();
// 连接两个通道,并从in通道读取,写入out中
in.transferTo(0, in.size(), out);
} catch (Exception e) {
e.printStackTrace();
}
}