使用通道传输进行文件串联
// 来自 N o w J a v a . c o m - 时 代 Java import java.io.FileInputStream; import java.nio.channels.Channels; import java.nio.channels.FileChannel; import java.nio.channels.WritableByteChannel; public class Main { public static void main(String[] argv) throws Exception { String[] files = new String[] { "a.txt", "b.txt" }; catFiles(Channels.newChannel(System.out), files); } private static void catFiles(WritableByteChannel target, String[] files) throws Exception {/**n o w j a v a . c o m - 时代Java**/ for (int i = 0; i < files.length; i++) { FileInputStream fis =