本文整理了Java中com.android.tools.build.bundletool.model.ZipPath.toString()
方法的一些代码示例,展示了ZipPath.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipPath.toString()
方法的具体详情如下:
包路径:com.android.tools.build.bundletool.model.ZipPath
类名称:ZipPath
方法名:toString
[英]Returns the path as used in the zip file.
[中]返回zip文件中使用的路径。
代码示例来源:origin: google/bundletool
/** Gets the total compressed sizes represented by the APK paths. */
private long getCompressedSize(ImmutableList<ZipPath> apkPaths) {
return apkPaths.stream().mapToLong(apkPath -> sizeByApkPaths.get(apkPath.toString())).sum();
}
}
代码示例来源:origin: google/bundletool
private static ImmutableMap<String, ModuleEntry> buildApexPathToEntryMap(
List<TargetedApexImage> allTargetedImages, ModuleSplit moduleSplit) {
ImmutableMap<String, ModuleEntry> pathToEntry =
Maps.uniqueIndex(moduleSplit.getEntries(), entry -> entry.getPath().toString());
return allTargetedImages.stream()
.map(TargetedApexImage::getPath)
.collect(toImmutableMap(identity(), pathToEntry::get));
}
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setFileTypeInvalidApexImagePath(
FileTypeInvalidApexImagePathError.newBuilder()
.setInvalidFile(file.toString())
.setBundleDirectory(apexDirectory.toString()));
}
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setFileTypeInvalidNativeLibraryPath(
FileTypeInvalidNativeLibraryPathError.newBuilder()
.setInvalidFile(file.toString())
.setBundleDirectory(libDirectory.toString()));
}
}
代码示例来源:origin: google/bundletool
private ApkDescription writeSystemApkToDiskInternal(
ModuleSplit systemSplit, Path outputDirectory, SystemApkMetadata.SystemApkType apkType) {
ZipPath apkPath = apkPathManager.getApkPath(systemSplit);
apkSerializerHelper.writeToZipFile(systemSplit, outputDirectory.resolve(apkPath.toString()));
return createSystemApkDescription(systemSplit, apkPath, apkType);
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setFileTypeInvalidFileExtension(
FileTypeInvalidFileExtensionError.newBuilder()
.setRequiredExtension(extensionRequired)
.setBundleDirectory(directory.toString())
.setInvalidFile(invalidFile.toString()));
}
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setFileTypeInvalidFileName(
FileTypeInvalidFileNameInDirectoryError.newBuilder()
.setInvalidFile(file.toString())
.addAllowedFileName(allowedFileName)
.setBundleDirectory(directory.toString()));
}
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setFileTypeFileUsesReservedName(
FileTypeFileUsesReservedNameError.newBuilder().setInvalidFile(file.toString()));
}
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setFileTypeUnknownFileOrDirectoryInModule(
FileTypeUnknownFileOrDirectoryFoundInModuleError.newBuilder()
.setInvalidFile(file.toString()));
}
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setMandatoryBundleFileMissing(
MandatoryBundleFileMissingError.newBuilder().setMissingFile(file.toString()));
}
}
代码示例来源:origin: google/bundletool
private static void checkModuleHasAndroidManifest(
ZipFile zipFile, ZipPath moduleBaseDir, String moduleName) {
ZipPath moduleManifestPath =
moduleBaseDir.resolve(SpecialModuleEntry.ANDROID_MANIFEST.getPath());
if (zipFile.getEntry(moduleManifestPath.toString()) == null) {
throw new MandatoryModuleFileMissingException(
moduleName, SpecialModuleEntry.ANDROID_MANIFEST.getPath());
}
}
}
代码示例来源:origin: google/bundletool
/**
* Returns the base name of the subpath composed from the first element up to and including the
* given element index.
*
* <p>See {@link ZipPath#subpath} and {@link TargetedDirectory#getPathBaseName}.
*/
public String getSubPathBaseName(int maxIndex) {
return originalPath()
.subpath(0, maxIndex + 1)
.resolveSibling(getPathSegments().get(maxIndex).getName())
.toString();
}
代码示例来源:origin: google/bundletool
@Override
protected void customizeProto(BundleToolError.Builder builder) {
builder.setResourceTableReferencesFilesOutsideRes(
ResourceTableReferencesFilesOutsideResError.newBuilder()
.setModuleName(moduleName)
.setFilePath(referencedFile.toString()));
}
}
代码示例来源:origin: google/bundletool
private static ImmutableSet<String> getEntriesPaths(ModuleSplit moduleSplit) {
return moduleSplit.getEntries().stream()
.map(moduleEntry -> moduleEntry.getPath().toString())
.collect(toImmutableSet());
}
}
代码示例来源:origin: google/bundletool
@Test
public void testToString() {
assertThat(ZipPath.create("").toString()).isEmpty();
assertThat(ZipPath.create("/").toString()).isEmpty();
assertThat(ZipPath.create("foo/bar").toString()).isEqualTo("foo/bar");
assertThat(ZipPath.create("/foo//bar/").toString()).isEqualTo("foo/bar");
}
代码示例来源:origin: google/bundletool
@Test
public void fromModuleZipEntry_getPathPreservesAllDirectories() {
ModuleZipEntry moduleEntry =
ModuleZipEntry.fromModuleZipEntry(new ZipEntry("/resource1"), zipFile);
assertThat(moduleEntry.getPath().toString()).isEqualTo("resource1");
}
代码示例来源:origin: google/bundletool
@Test
public void ofFile_shouldCompressFalse() {
InMemoryModuleEntry moduleEntry =
InMemoryModuleEntry.ofFile(PATH, CONTENT, /* shouldCompress = */ false);
assertThat(moduleEntry.getPath().toString()).isEqualTo(PATH);
assertThat(moduleEntry.getContentAsBytes().toByteArray()).isEqualTo(CONTENT);
assertThat(moduleEntry.shouldCompress()).isFalse();
}
代码示例来源:origin: google/bundletool
@Test
public void ofFile() {
InMemoryModuleEntry moduleEntry = InMemoryModuleEntry.ofFile(PATH, CONTENT);
assertThat(moduleEntry.getPath().toString()).isEqualTo(PATH);
assertThat(moduleEntry.getContentAsBytes().toByteArray()).isEqualTo(CONTENT);
assertThat(moduleEntry.isDirectory()).isFalse();
assertThat(moduleEntry.shouldCompress()).isTrue();
}
代码示例来源:origin: google/bundletool
private ResourceTable buildResourceTableForEmbeddedWearApk(ZipPath wearableApkPath) {
return new ResourceTableBuilder()
.addPackage(PACKAGE_NAME)
.addXmlResource(WEAR_DESC_XML_RES_NAME, WEAR_DESC_XML_RES_PATH)
.addFileResource(RAW_TYPE, WEAR_APK_RES_NAME, wearableApkPath.toString())
.build();
}
代码示例来源:origin: google/bundletool
public static ApkDescription splitApkDescription(ApkTargeting apkTargeting, ZipPath apkPath) {
return ApkDescription.newBuilder()
.setTargeting(apkTargeting)
.setPath(apkPath.toString())
// Contents of the split APK metadata is not important for these tests as long as
// the field is set.
.setSplitApkMetadata(SplitApkMetadata.getDefaultInstance())
.build();
}
内容来源于网络,如有侵权,请联系作者删除!