<commit_before>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.yobidashi.media.music

import android.content.ContentResolver
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import timber.log.Timber
import java.io.FileNotFoundException

/**
 * @author toastkidjp
 */
class AlbumArtFinder(private val contentResolver: ContentResolver) {

    operator fun invoke(album1Uri: Uri): Bitmap? {
        try {
            return BitmapFactory.decodeStream(contentResolver.openInputStream(album1Uri))
        } catch (e: FileNotFoundException) {
            Timber.e(e)
        }
        return null
    }

}<commit_msg>bugfix #496 Fix loading with use function.<commit_after>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.yobidashi.media.music

import android.content.ContentResolver
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import timber.log.Timber
import java.io.FileNotFoundException

/**
 * @author toastkidjp
 */
class AlbumArtFinder(private val contentResolver: ContentResolver) {

    operator fun invoke(album1Uri: Uri): Bitmap? {
        try {
            return contentResolver.openInputStream(album1Uri).use {
                BitmapFactory.decodeStream(it)
            }
        } catch (e: FileNotFoundException) {
            Timber.e(e)
        }
        return null
    }

}
{'fraction_non_alphanumeric': 0.08410732714138287, 'fraction_numerical': 0.011867905056759546, 'mean_word_length': 3.3868778280542986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1464349', 'n_tokens_mistral': 555, 'n_tokens_neox': 516, 'n_words': 153}