package cn.yyxx.eyuangame.core.utils

import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import java.io.FileInputStream
import java.io.FileNotFoundException

/**
 * @author #Suyghur.
 * Created on 2021/07/28
 */
object LocalCacheUtils {

    fun getLocalBitmap(context: Context, name: String): Bitmap? {
        try {
            val path = "${context.getExternalFilesDir("cache")!!.absolutePath}/$name"
            val fis = FileInputStream(path)
            return BitmapFactory.decodeStream(fis)
        } catch (e: FileNotFoundException) {
            e.printStackTrace()
        }
        return null
    }
}