Code example for FileInputStream

Methods: getChannel

    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) {
Stop searching for code, let great code find you!  Add Codota to your java IDE