org.robolectric.res.Fs.externalize()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.robolectric.res.Fs.externalize()方法的一些代码示例,展示了Fs.externalize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fs.externalize()方法的具体详情如下:
包路径:org.robolectric.res.Fs
类名称:Fs
方法名:externalize

Fs.externalize介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

FileTypedResource(Path path, ResType resType, XmlContext xmlContext) {
 super(Fs.externalize(path), resType, xmlContext);
 this.path = path;
}

代码示例来源:origin: robolectric/robolectric

public String8(Path value) {
 this(Fs.externalize(value));
}

代码示例来源:origin: robolectric/robolectric

/** @deprecated use {@link Fs#externalize(Path)} instead. */
@Deprecated
default String getPath() {
 return Fs.externalize(this);
}

代码示例来源:origin: robolectric/robolectric

public boolean addDefaultAssets(Path systemAssetsPath) {
 return addDefaultAssets(Fs.externalize(systemAssetsPath));
}

代码示例来源:origin: robolectric/robolectric

public static Asset newFileAsset(FileTypedResource fileTypedResource) throws IOException {
 _FileAsset fileAsset = new _FileAsset();
 Path path = fileTypedResource.getPath();
 fileAsset.mFileName = Fs.externalize(path);
 fileAsset.mLength = Files.size(path);
 fileAsset.mBuf = Fs.getBytes(path);
 return fileAsset;
}

代码示例来源:origin: robolectric/robolectric

/** Parses an AndroidManifest.xml file using the framework PackageParser. */
public static Package callParsePackage(Path apkFile) {
 PackageParser packageParser = new PackageParser();
 int flags = PackageParser.PARSE_IGNORE_PROCESSES;
 try {
  Package thePackage;
  if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.LOLLIPOP) {
   thePackage = packageParser.parsePackage(apkFile.toFile(), flags);
  } else { // JB -> KK
   thePackage =
     reflector(_PackageParser_.class, packageParser)
       .parsePackage(
         apkFile.toFile(), Fs.externalize(apkFile), new DisplayMetrics(), flags);
  }
  if (thePackage == null) {
   List<LogItem> logItems = ShadowLog.getLogsForTag("PackageParser");
   if (logItems.isEmpty()) {
    throw new RuntimeException(
      "Failed to parse package " + apkFile);
   } else {
    LogItem logItem = logItems.get(0);
    throw new RuntimeException(
      "Failed to parse package " + apkFile + ": " + logItem.msg, logItem.throwable);
   }
  }
  return thePackage;
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: robolectric/robolectric

private void populateAssetPaths(AssetManager assetManager, AndroidManifest appManifest) {
 for (AndroidManifest manifest : appManifest.getAllManifests()) {
  if (manifest.getAssetsDirectory() != null) {
   assetManager.addAssetPath(Fs.externalize(manifest.getAssetsDirectory()));
  }
 }
}

相关文章