本文整理了Java中org.robolectric.res.Fs.fromJar()
方法的一些代码示例,展示了Fs.fromJar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fs.fromJar()
方法的具体详情如下:
包路径:org.robolectric.res.Fs
类名称:Fs
方法名:fromJar
暂无
代码示例来源:origin: org.robolectric/robolectric
@Nonnull
private ResourcePath createRuntimeSdkResourcePath(DependencyResolver dependencyResolver) {
try {
Fs systemResFs = Fs.fromJar(dependencyResolver.getLocalArtifactUrl(sdkConfig.getAndroidSdkDependency()));
Class<?> androidRClass = getRobolectricClassLoader().loadClass("android.R");
Class<?> androidInternalRClass = getRobolectricClassLoader().loadClass("com.android.internal.R");
// TODO: verify these can be loaded via raw-res path
return new ResourcePath(androidRClass,
systemResFs.join("raw-res/res"),
systemResFs.join("raw-res/assets"),
androidInternalRClass);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.robolectric/resources
public static FsFile fromURL(URL url) {
switch (url.getProtocol()) {
case "file":
return new FileFsFile(new File(url.getPath()));
case "jar":
String[] parts = url.getPath().split("!", 0);
try {
Fs fs = fromJar(new URL(parts[0]));
return fs.join(parts[1].substring(1));
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e);
}
default:
throw new IllegalArgumentException("unsupported fs type for '" + url + "'");
}
}
内容来源于网络,如有侵权,请联系作者删除!