标签:except imp md5值 apache catch string cep final 远程
import org.apache.commons.codec.digest.DigestUtils
/**
* 获取远程url文件的MD5值
*/
fun getMd5Hex(url: URL): String {
var urlIS: InputStream? = null
var dataInputStream: DataInputStream? = null
try {
urlIS = url.openStream()
dataInputStream = DataInputStream(urlIS);
return DigestUtils.md5Hex(dataInputStream);
} catch (e: Exception) {
throw e
} finally {
dataInputStream?.close();
urlIS?.close()
}
}
标签:except imp md5值 apache catch string cep final 远程
原文地址:http://blog.51cto.com/881206524/2171379