JAVA NIOFileChannel source = new FileInputStream(sourceFile).getChannel();; FileChannel destination = new FileOutputStream(destFile).getChannel(); destination.transferFrom(source, 0, source.size());
java 7 : java.nio.file.Filesstatic long copy(InputStream in, Path target, CopyOption... options) Copies all bytes from an input stream to a file.static long copy(Path source, OutputStream out) Copies all bytes from a file to an output stream.static Path copy(Path source, Path target, CopyOption... options) Copy a file to a target file.
FileChannel destination = new FileOutputStream(destFile).getChannel();
destination.transferFrom(source, 0, source.size());
Copies all bytes from an input stream to a file.static long copy(Path source, OutputStream out)
Copies all bytes from a file to an output stream.static Path copy(Path source, Path target, CopyOption... options)
Copy a file to a target file.