[2.15.0][增量升级] 移除无用的工具类
This commit is contained in:
@@ -4,8 +4,7 @@ import android.content.*
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import com.github.sisong.*
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.launcher.patch.utils.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import java.io.File
|
||||
|
||||
internal object PatchManager {
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.launcher.patch.utils
|
||||
|
||||
import java.io.*
|
||||
import java.nio.channels.FileChannel.MapMode
|
||||
import java.security.*
|
||||
|
||||
class Md5Util {
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* 获取单个文件的MD5值!
|
||||
* @param file
|
||||
* @return
|
||||
* 解决首位0被省略问题
|
||||
*/
|
||||
fun getMd5FromFile(file: File): String? {
|
||||
var stringbuffer: StringBuffer? = null
|
||||
try {
|
||||
val hexDigits = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')
|
||||
val input = FileInputStream(file)
|
||||
val ch = input.channel
|
||||
val byteBuffer = ch.map(MapMode.READ_ONLY, 0, file.length())
|
||||
val digest = MessageDigest.getInstance("MD5")
|
||||
digest.update(byteBuffer)
|
||||
val bytes = digest.digest()
|
||||
val n = bytes.size
|
||||
stringbuffer = StringBuffer(2 * n)
|
||||
for (l in 0 until n) {
|
||||
val bt = bytes[l]
|
||||
val c0 = hexDigits[bt.toInt() and 0xf0 shr 4]
|
||||
val c1 = hexDigits[bt.toInt() and 0xf]
|
||||
stringbuffer.append(c0)
|
||||
stringbuffer.append(c1)
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return stringbuffer?.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user