public File writeUriToTempFile(final Uri uri, final String fileName) {
        File file = null;
        InputStream is = null;
        OutputStream os = null;
        try {
            is = openForRead(uri);
            if (is == null) {
                return null;
            }
            file = createTempFile(fileName);
            os = new FileOutputStream(file);
            IOUtils.copy(is, os);
        } catch (IOException ie) {
            reportProblem(R.string.contentstorage_err_copy_failed, ie, false, uri, file, false);
            if (file != null && !file.delete()) {
                Log.i("File could not be deleted: " + file);
            }
        } finally {
            closeQuietly(is, os);
        }
        return file;
    }
Writes the content of given Uri to a (temporary!) File
main/src/main/java/cgeo/geocaching/storage/ContentStorage.java