1
0
Fork 0

Improve readability

This commit is contained in:
hpi1 2017-06-16 00:40:19 +03:00
parent 79d0e214df
commit 02d1d21163
1 changed files with 33 additions and 18 deletions

View File

@ -59,28 +59,43 @@ public class BDJClassLoader extends URLClassLoader {
path = basePath + "/" + classPath;
if (path.length() < 5)
return null;
String protocol = null;
String url = path.substring(0, 5);
for (int i = 0; i < appCaches.length; i++) {
if (appCaches[i].getRefToName().equals(url)) {
if (appCaches[i].getType() == AppCache.JAR_FILE) {
protocol = "file:";
url = url + ".jar";
} else if (appCaches[i].getType() == AppCache.DIRECTORY) {
protocol = "file:/";
}
String name = path.substring(0, 5); /* entry name in BDMV/JAR/ */
String dir = path.substring(5); /* optional sub directory */
/* find bdjo AppCache entry */
int i;
for (i = 0; i < appCaches.length; i++) {
if (appCaches[i].getRefToName().equals(name)) {
break;
}
}
if (protocol == null)
if (i >= appCaches.length)
return null;
url = protocol +
BDJLoader.getCachedFile(System.getProperty("bluray.vfs.root") + File.separator +
"BDMV" + File.separator +
"JAR" + File.separator +
url) + path.substring(5);
//if (!url.endsWith("/"))
// url += "/";
/* check AppCache type */
String protocol;
if (appCaches[i].getType() == AppCache.JAR_FILE) {
protocol = "file:";
name = name + ".jar";
} else if (appCaches[i].getType() == AppCache.DIRECTORY) {
protocol = "file:/";
} else {
return null;
}
/* map to disc root */
String fullPath =
System.getProperty("bluray.vfs.root") + File.separator +
"BDMV" + File.separator + "JAR" + File.separator +
name;
/* find from cache */
String cachePath = BDJLoader.getCachedFile(fullPath);
/* build final url */
String url = protocol + cachePath + dir;
try {
return new URL(url);
} catch (MalformedURLException e) {