Flask接口签名sign原理与实例代码浅析
512
2023-03-22
Java实现多个文档合并输出到一个文档
本文实例为大家分享了java实现多个文档合并输出到一个文档的具体代码,供大家参考,具体内容如下
方法:Java NIO
package First;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;
import java.nio.channels.WritableByteChannel;
public class Test {
public static void main(String params[]) throws Exception {
String[] iF = new String[] {"E:/test1.txt", "E:/test2.txt", "E:/test3.txt", "E:/test4.txt" };
String oF = "E:/out.txt";
FileOutputStream output = new FileOutputStream(new File(oF));
WritableByteChannel targetChannel = output.getChannel();
http://
for(int i GKPsl=0; i FileInputStream input = new FileInputStream(iF[i]); FileChannel inputChannel = input.getChannel(); inputChannel.transferTo(0, inputChannel.size(), targetChannel); inputChannel.close(); input.close(); } targetChannel.close(); output.close(); System.out.println("All jobs done..."); } } GKPsl
FileInputStream input = new FileInputStream(iF[i]);
FileChannel inputChannel = input.getChannel();
inputChannel.transferTo(0, inputChannel.size(), targetChannel);
inputChannel.close();
input.close();
}
targetChannel.close();
output.close();
System.out.println("All jobs done...");
}
}
GKPsl
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~