Code example for FileChannel

Methods: size, transferTo

0
        FileChannel srcChannel = null;
        FileChannel destChannel = null;
        try { 
            srcChannel = is.getChannel();
            destChannel = os.getChannel();
            return srcChannel.transferTo(0, srcChannel.size(), destChannel);
        } finally { 
            CloseableUtils.close(srcChannel);
            CloseableUtils.close(destChannel);
        } 
    } 
 
    public static String getName(String path) {
        return new File(path).getName();
    } 
 
    public static String getName(Uri uri) {
        return new File(uri.toString()).getName();
    } 
 
    public static boolean createNewFile(File file) {