File file = new File("C:\\Users\\dailei\\Desktop\\test\\1.txt"); File file2 = new File("C:\\Users\\dailei\\Desktop\\test\\4.txt"); try { FileChannel inChannel = new FileInputStream(file).getChannel(); FileChannel outChannel = new FileOutputStream(file2).getChannel(); ByteBuffer cb = ByteBuffer.allocate(64); while((inChannel.read(cb)) != -1) { cb.flip(); outChannel.write(cb); cb.clear(); } }catch(IOException e) { e.printStackTrace(); }