feat: runtime.loadJar() cache dex
This commit is contained in:
@@ -395,6 +395,19 @@ public class PFiles {
|
||||
return file.delete();
|
||||
}
|
||||
|
||||
public static boolean deleteFilesOfDir(File dir) {
|
||||
if (!dir.isDirectory())
|
||||
throw new IllegalArgumentException("not a directory: " + dir);
|
||||
File[] children = dir.listFiles();
|
||||
if (children != null) {
|
||||
for (File child : children) {
|
||||
if (!deleteRecursively(child))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean remove(String path) {
|
||||
return new File(path).delete();
|
||||
}
|
||||
|
||||
26
common/src/main/java/com/stardust/util/MD5.java
Normal file
26
common/src/main/java/com/stardust/util/MD5.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.stardust.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class MD5 {
|
||||
|
||||
public static byte[] md5Bytes(String message) throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
md5.update(message.getBytes());
|
||||
return md5.digest();
|
||||
}
|
||||
|
||||
public static String md5(String message) throws NoSuchAlgorithmException {
|
||||
byte[] bytes = md5Bytes(message);
|
||||
StringBuilder hexString = new StringBuilder(32);
|
||||
for (byte b : bytes) {
|
||||
String hex = Integer.toHexString(0xFF & b);
|
||||
if (hex.length() == 1) {
|
||||
hexString.append('0');
|
||||
}
|
||||
hexString.append(hex);
|
||||
}
|
||||
return hexString.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user