private static void doCopySmallFile(File source, File destination) throws IOException {
    """
	Simple implementation without chunking if the source file is big.
	
	@param source
	@param destination
	@throws java.io.IOException
    """
        if (destination.exists() && destination.isDirectory()) {
            throw new IOException("Can not copy file, destination is a directory: " + destination.getAbsolutePath());
        }

        FileInputStream fis = null;
        FileOutputStream fos = null;
        FileChannel input = null;
        FileChannel output = null;
        try {
            fis = new FileInputStream(source);
            fos = new FileOutputStream(destination, false);
            input = fis.getChannel();
            output = fos.getChannel();
            output.transferFrom(input, 0, input.size());
        } finally {
            closeQuietly(output);
            closeQuietly(input);
            closeQuietly(fis);
            closeQuietly(fos);
        }
        if (destination.length() != source.length()) {
            throw new IOException("Failed to copy content from '" +
                    source + "' (" + source.length() + "bytes) to '" + destination + "' (" + destination.length() + ")");
        }

    }
private static void doCopySmallFile(File source, File destination) throws IOException {
        if (destination.exists() && destination.isDirectory()) {
            throw new IOException("Can not copy file, destination is a directory: " + destination.getAbsolutePath());
        }

        FileInputStream fis = null;
        FileOutputStream fos = null;
        FileChannel input = null;
        FileChannel output = null;
        try {
            fis = new FileInputStream(source);
            fos = new FileOutputStream(destination, false);
            input = fis.getChannel();
            output = fos.getChannel();
            output.transferFrom(input, 0, input.size());
        } finally {
            closeQuietly(output);
            closeQuietly(input);
            closeQuietly(fis);
            closeQuietly(fos);
        }
        if (destination.length() != source.length()) {
            throw new IOException("Failed to copy content from '" +
                    source + "' (" + source.length() + "bytes) to '" + destination + "' (" + destination.length() + ")");
        }

    }
private static void doCopySmallFile ( File source , File destination ) throws IOException { if ( destination . exists ( ) && destination . isDirectory ( ) ) { throw new IOException ( "Can not copy file, destination is a directory: " + destination . getAbsolutePath ( ) ) ; } FileInputStream fis = null ; FileOutputStream fos = null ; FileChannel input = null ; FileChannel output = null ; try { fis = new FileInputStream ( source ) ; fos = new FileOutputStream ( destination , false ) ; input = fis . getChannel ( ) ; output = fos . getChannel ( ) ; output . transferFrom ( input , 0 , input . size ( ) ) ; } finally { closeQuietly ( output ) ; closeQuietly ( input ) ; closeQuietly ( fis ) ; closeQuietly ( fos ) ; } if ( destination . length ( ) != source . length ( ) ) { throw new IOException ( "Failed to copy content from '" + source + "' (" + source . length ( ) + "bytes) to '" + destination + "' (" + destination . length ( ) + ")" ) ; } }
Simple implementation without chunking if the source file is big.

@param source
@param destination
@throws java.io.IOException
Simple implementation without chunking if the source file is big .