resources/src/main/java/org/robolectric/res/android/CppAssetManager.java
static Asset openAssetFromZipLocked(final ZipFileRO pZipFile,
      final ZipEntryRO entry, AccessMode mode, final String8 entryName) {
    Asset pAsset = null;

    // TODO: look for previously-created shared memory slice?
    final Ref<Short> method = new Ref<>((short) 0);
    final Ref<Long> uncompressedLen = new Ref<>(0L);

    //printf("USING Zip '%s'\n", pEntry.getFileName());

    if (!pZipFile.getEntryInfo(entry, method, uncompressedLen, null, null,
        null, null)) {
      ALOGW("getEntryInfo failed\n");
      return null;
    }

    //return Asset.createFromZipEntry(pZipFile, entry, entryName);
    FileMap dataMap = pZipFile.createEntryFileMap(entry);
//      if (dataMap == null) {
//          ALOGW("create map from entry failed\n");
//          return null;
//      }
//
    if (method.get() == ZipFileRO.kCompressStored) {
      pAsset = Asset.createFromUncompressedMap(dataMap, mode);
      ALOGV("Opened uncompressed entry %s in zip %s mode %s: %s", entryName.string(),
          pZipFile.mFileName, mode, pAsset);
    } else {
      pAsset = Asset.createFromCompressedMap(dataMap, toIntExact(uncompressedLen.get()), mode);
      ALOGV("Opened compressed entry %s in zip %s mode %s: %s", entryName.string(),
          pZipFile.mFileName, mode, pAsset);
    }
    if (pAsset == null) {
         /* unexpected */
      ALOGW("create from segment failed\n");
    }

    return pAsset;
  }
static Asset openAssetFromZipLocked(final ZipFileRO pZipFile,
      final ZipEntryRO entry, AccessMode mode, final String8 entryName) {
    Asset pAsset = null;

    // TODO: look for previously-created shared memory slice?
    final Ref<Short> method = new Ref<>((short) 0);
    final Ref<Long> uncompressedLen = new Ref<>(0L);

    //printf("USING Zip '%s'\n", pEntry.getFileName());

    if (!pZipFile.getEntryInfo(entry, method, uncompressedLen, null, null,
        null, null)) {
      ALOGW("getEntryInfo failed\n");
      return null;
    }

    //return Asset.createFromZipEntry(pZipFile, entry, entryName);
    FileMap dataMap = pZipFile.createEntryFileMap(entry);
//      if (dataMap == null) {
//          ALOGW("create map from entry failed\n");
//          return null;
//      }
//
    if (method.get() == ZipFileRO.kCompressStored) {
      pAsset = Asset.createFromUncompressedMap(dataMap, mode);
      ALOGV("Opened uncompressed entry %s in zip %s mode %s: %s", entryName.string(),
          pZipFile.mFileName, mode, pAsset);
    } else {
      pAsset = Asset.createFromCompressedMap(dataMap, toIntExact(uncompressedLen.get()), mode);
      ALOGV("Opened compressed entry %s in zip %s mode %s: %s", entryName.string(),
          pZipFile.mFileName, mode, pAsset);
    }
    if (pAsset == null) {
         /* unexpected */
      ALOGW("create from segment failed\n");
    }

    return pAsset;
  }
/*
Given an entry in a Zip archive, create a new Asset object.

If the entry is uncompressed, we may want to create or share a
slice of shared memory.