本文整理了Java中org.robolectric.res.Fs.forJar()
方法的一些代码示例,展示了Fs.forJar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fs.forJar()
方法的具体详情如下:
包路径:org.robolectric.res.Fs
类名称:Fs
方法名:forJar
暂无
代码示例来源:origin: robolectric/robolectric
@Override
Collection<Path> getAllAssetDirs() {
ArrayList<Path> paths = new ArrayList<>();
for (AssetPath assetPath : cppAssetManager.getAssetPaths()) {
if (Files.isRegularFile(assetPath.file)) {
paths.add(Fs.forJar(assetPath.file).getPath("assets"));
} else {
paths.add(assetPath.file);
}
}
return paths;
}
代码示例来源:origin: robolectric/robolectric
public static FileSystem forJar(URL url) {
return forJar(Paths.get(toUri(url)));
}
代码示例来源:origin: robolectric/robolectric
@Nonnull
private ResourcePath createRuntimeSdkResourcePath() {
try {
FileSystem zipFs = Fs.forJar(sdk.getJarPath());
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,
zipFs.getPath("raw-res/res"),
zipFs.getPath("raw-res/assets"),
androidInternalRClass);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: robolectric/robolectric
@Override
Collection<Path> getAllAssetDirs() {
ApkAssets[] apkAssetsArray = reflector(_AssetManager28_.class, realAssetManager).getApkAssets();
ArrayList<Path> assetDirs = new ArrayList<>();
for (ApkAssets apkAssets : apkAssetsArray) {
long apk_assets_native_ptr = ((ShadowArscApkAssets9) Shadow.extract(apkAssets)).getNativePtr();
CppApkAssets cppApkAssets = Registries.NATIVE_APK_ASSETS_REGISTRY.getNativeObject(apk_assets_native_ptr);
if (new File(cppApkAssets.GetPath()).isFile()) {
assetDirs.add(Fs.forJar(Paths.get(cppApkAssets.GetPath())).getPath("assets"));
} else {
assetDirs.add(Paths.get(cppApkAssets.GetPath()));
}
}
return assetDirs;
}
内容来源于网络,如有侵权,请联系作者删除!