Here you can find the source of copyFileContent(final String sourcePath, final String targetPath)
public static boolean copyFileContent(final String sourcePath, final String targetPath)
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.FileOutputStream; import java.nio.channels.FileChannel; public class Main { public static boolean copyFileContent(final String sourcePath, final String targetPath) { FileInputStream fr = null; FileOutputStream fw = null; try {/*from ww w . j a v a2s. c o m*/ fr = new FileInputStream(sourcePath); fw = new FileOutputStream(targetPath); final FileChannel src = fr.getChannel(); final FileChannel dest = fw.getChannel(); dest.transferFrom(src, 0, src.size()); return true; } catch (final Exception e) { return false; } finally { try { fr.close(); fw.close(); } catch (final Exception e) { return false; } } } }