Code example for FileInputStream

Methods: getChannel

0
    public static long copyFileStream(FileInputStream is, FileOutputStream os)
            throws IOException { 
        FileChannel srcChannel = null;
        FileChannel destChannel = null;
        try { 
            srcChannel = is.getChannel();
            destChannel = os.getChannel();
            return srcChannel.transferTo(0, srcChannel.size(), destChannel);
        } finally { 
            if (srcChannel != null) srcChannel.close();
            if (destChannel != null) destChannel.close();
        } 
    } 
 
    /** 
     * Obtains file {@link Uri} that refers to a recently taken photo. 
     * @param file to search 
     * @return photo file uri. 
     */ 
    private Uri findPhotoFromRecentlyTaken(File file) {
        if (mRecentlyUpdatedPhotos == null)