标签:文件中 images text 打开 int users cin catch exception
在打开Android Studio项目的时候,会下载项目对应版本的gradle,该版本是在项目根目录下\gradle\wrapper\gradle-wrapper.properties文件中指定的:
下载的gradle文件在Windows电脑上会缓存在C:\Users\xxx(用户名)\.gradle\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9目录下
那这个目录名55gk2rcmfc6p2dg9u9ohc3hw9是根据什么规则生成的呢?看似没有规律,研究了一下,发现也是按照一定规则生成的,如下:
1.从gradle/wrapper/gradle-wrapper.properties中得到distributionUrl,即https://services.gradle.org/distributions/gradle-3.3-all.zip,注意文件中的\不算
2.对distributionUrl进行MD5运算
3.根据MD5值构造一个uint 128位整数
4.将整数利用base36得到base36的值(取小写)
java代码如下:
public static String getFileName(String distributionUrl) { MessageDigest messageDigest = null; try { messageDigest = MessageDigest.getInstance("MD5"); messageDigest.update(distributionUrl.getBytes()); String str = new BigInteger(1, messageDigest.digest()).toString(36); return str; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; }
distributionUrl |
base36 |
https://services.gradle.org/distributions/gradle-3.3-all.zip |
55gk2rcmfc6p2dg9u9ohc3hw9 |
https://services.gradle.org/distributions/gradle-3.2-all.zip |
97ld1dyml0oep92x4lyn4g235 |
https://services.gradle.org/distributions/gradle-3.1-all.zip |
ejgglywf033yp6s4x8ahmgm74 |
https://services.gradle.org/distributions/gradle-3.0-all.zip |
6v8c6qg2jpi8twyfv2a5s9mii |
https://services.gradle.org/distributions/gradle-2.14.1-all.zip |
8bnwg5hd3w55iofp58khbp6yv |
https://services.gradle.org/distributions/gradle-2.14-all.zip |
t7wfomcrmv8dmyii9c9waem8 |
https://services.gradle.org/distributions/gradle-2.13-all.zip |
1b9wlm73elu4cqnbc0rk7r7qn |
https://services.gradle.org/distributions/gradle-2.12-all.zip |
8ywkdai6puj5z81fume4e7njw |
https://services.gradle.org/distributions/gradle-2.11-all.zip |
ace7yl0a7udokebb27mt9s3qr |
https://services.gradle.org/distributions/gradle-2.10-all.zip |
a4w5fzrkeut1ox71xslb49gst
|
标签:文件中 images text 打开 int users cin catch exception
原文地址:http://www.cnblogs.com/rainboy2010/p/7062279.html