Code example for FileInputStream

Methods: close, getChannel

0
     * @param src source {@link File} 
     * @param dst destination {@link File} 
     * @throws IOException 
     */ 
    public static void copyFile(File src, File dst) throws IOException {
        FileInputStream in = new FileInputStream(src);
        FileOutputStream out = new FileOutputStream(dst);
        FileChannel inChannel = in.getChannel();
        FileChannel outChannel = out.getChannel();
 
        try { 
            inChannel.transferTo(0, inChannel.size(), outChannel);
        } finally { 
            if (inChannel != null) {
                inChannel.close();
            } 
            if (outChannel != null) {
                outChannel.close();
            } 
        } 
 
        in.close();
        out.close();
    } 
 
    /** 
     * Copies data from one input stream to the other using a buffer of 8