Code example for FileChannel

Methods: close, size, transferTo

0
        FileOutputStream ostream = new FileOutputStream(destFile);
        FileChannel input = istream.getChannel();
        FileChannel output = ostream.getChannel();
 
        try { 
            input.transferTo(0, input.size(), output);
        } finally { 
            istream.close();
            ostream.close();
            input.close();
            output.close();
        } 
    } 
 
    /** 
     * Copy a directory 
     * 
     * @param srcDir directory to be copied 
     * @param destinationDir destination to be copied to 
     * @return a DirectoryEntry object 
     * @throws JSONException