@Test public void givesPathWithinModule() throws Exception { File bundleFile = TestUtils.getTestDataFile(APP_BUNDLE); try (ZipFile zipFile = new ZipFile(bundleFile)) { ZipEntry entry = zipFile.getEntry("base/manifest/AndroidManifest.xml"); ZipFileData data = new ZipFileData(zipFile, entry); assertThat((Object) data.getPathWithinModule()) .isEqualTo(Paths.get("manifest/AndroidManifest.xml")); } }
@Override public Path getPathWithinModule() { if (cachedPathWithinModule != null) { return cachedPathWithinModule; } Path fullPath = getPathWithinRoot(); if (fullPath.getNameCount() <= 1 || fullPath.startsWith("BUNDLE-METADATA") || fullPath.startsWith("META-INF")) { cachedPathWithinModule = fullPath; } else { cachedPathWithinModule = fullPath.subpath(1, fullPath.getNameCount()); } return cachedPathWithinModule; }
ZipFileData implements FileData { @Override public Path getPathWithinModule() { if (cachedPathWithinModule != null) { return cachedPathWithinModule; } Path fullPath = getPathWithinRoot(); if (fullPath.getNameCount() <= 1 || fullPath.startsWith("BUNDLE-METADATA") || fullPath.startsWith("META-INF")) { cachedPathWithinModule = fullPath; } else { cachedPathWithinModule = fullPath.subpath(1, fullPath.getNameCount()); } return cachedPathWithinModule; } }
ZipFileData implements FileData { @Override public Path getPathWithinModule() { if (cachedPathWithinModule != null) { return cachedPathWithinModule; } Path fullPath = getPathWithinRoot(); if (fullPath.getNameCount() <= 1 || fullPath.startsWith("BUNDLE-METADATA") || fullPath.startsWith("META-INF")) { cachedPathWithinModule = fullPath; } else { cachedPathWithinModule = fullPath.subpath(1, fullPath.getNameCount()); } return cachedPathWithinModule; } ZipFileData(ZipFile zipFile, ZipEntry entry); }
ZipFileData implements FileData { @Override public Path getPathWithinModule() { if (cachedPathWithinModule != null) { return cachedPathWithinModule; } Path fullPath = getPathWithinRoot(); if (fullPath.getNameCount() <= 1 || fullPath.startsWith("BUNDLE-METADATA") || fullPath.startsWith("META-INF")) { cachedPathWithinModule = fullPath; } else { cachedPathWithinModule = fullPath.subpath(1, fullPath.getNameCount()); } return cachedPathWithinModule; } ZipFileData(ZipFile zipFile, ZipEntry entry); @Override @MustBeClosed InputStream getInputStream(); @Override Path getPathWithinRoot(); @Override Path getPathWithinModule(); @Override long getSize(); long getCompressedSize(); }
ZipFileData implements FileData { @Override public Path getPathWithinModule() { if (cachedPathWithinModule != null) { return cachedPathWithinModule; } Path fullPath = getPathWithinRoot(); if (fullPath.getNameCount() <= 1 || fullPath.startsWith("BUNDLE-METADATA") || fullPath.startsWith("META-INF")) { cachedPathWithinModule = fullPath; } else { cachedPathWithinModule = fullPath.subpath(1, fullPath.getNameCount()); } return cachedPathWithinModule; } ZipFileData(ZipFile zipFile, ZipEntry entry); @Override @MustBeClosed InputStream getInputStream(); @Override Path getPathWithinRoot(); @Override Path getPathWithinModule(); @Override long getSize(); long getCompressedSize();  }